If you like Spring-Actuator and want to use it in a traditional spring app i.e. without using spring boot, it is surely possible. I was looking around for a solution and nothing really worked out of the box. I’m guessing because people don’t post the whole solution and/or don’t point out the usual suspects and /or caveats. I wrote a simple ‘traditional’ spring app with xml configuratipon. I might branch it out to a Java configuration as a comparison. Git repo is here:

 

Git repo spring-actuator-traditional-app

 

And to summarize it:

 

  • XML configuration; app context and mvc context with minimal conf that is
  • One MVC endpoint ála ‘hello-world’ which would represent e.g. REST layer
  • usual actuator endpoint such as /metrics, /dump, /health etc.
  • I added embedded tomcat so you can simply clone it and run it with ‘mvn tomcat7:run’
  • One Configuration class for actuator is all you need (and the maven dependency of course)

That’s it.

Leave a Reply

Your email address will not be published. Required fields are marked *