New Relic for Spring Boot

Recently, we have been converting tomcat / spring application to spring boot. Everything works great with the new relic. Is there a way that I can easily set up a new relic using the spring boot project. I do not want to hardcode the location of the new relic jar path, and then run the spring boot project using the path.

edit: spring boot project with maven

+7
spring spring-boot newrelic
source share
2 answers

You can enable the NewRelic Maven dependency and use the maven-dependency-plugin to unpack to the target/classes directory, which allows Maven to include it in the last Jar file. Then you need to add the Premain-Class attribute to the manifest file, and you can use your application banner as -javaagent source. You can find information about my blog post.

+8
source share

Step by step instructions

  • Extract files from the newrelic java agent archive.
  • Create a directory called newrelic in the root of your application.
  • Place newrelic.jar from the archive in the created newrelic folder above
  • Place the newrelic.yml YAML configuration file in the newrelic folder created above.
  • Update the values ​​in the newrelic.yml file as shown below.
    • license_key : 'your license key'
    • application_name : 'Your application name
  • Launch the application using the javaagent option
    • java -javaagent: newrelic \ newrelic.jar -jar yourapplication.jar
Parameter

-javaagent must be before -jar so that the agent can run

+4
source share

All Articles