Just a quick tip for the Spring fans out there…
If you’ve decided to try out Spring Boot Actuator – and if you haven’t you really should! – you may have run into one of two interesting hitches that are easily resolved:
- You are unable to access any of the various Actuator endpoints (/beans, /env, et al)
- You can access those endpoints and yet are unable to access /actuator, the primary (navigable) Actuator endpoint
Unable to access any Actuator endpoints
In the case of point #1 above, you may see this in your logs:
s.b.a.e.m.MvcEndpointSecurityInterceptor : Full authentication is required to access actuator endpoints. Consider adding Spring Security or set ‘management.security.enabled’ to false.
For testing, it’s adequate and acceptable to simply add the suggested entry to your app’s application.properties file:
This is far less likely to be a suitable solution for production apps, though. 🙂 Enabling Spring Security properly to secure access to your application is a far more production-ready option.
Unable to access /actuator
If you can load successfully the various Spring Boot Actuator endpoints but get a 404 error on /actuator, the primary (navigable) Actuator endpoint, you are hitting a different (yet also easily resolved) snag. The hint is in how I phrased the difficulty: the primary (navigable) Actuator endpoint.
In order to access /actuator, which uses hypermedia to provide a navigable structure of links to Actuator endpoints, you must include HATEOAS (spring-boot-starter-hateoas) on your classpath. Adding this to your POM will fix that nicely:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-hateoas</artifactId> </dependency>
That’s all for now, but stay tuned (or follow me on Twitter) for more quick or lengthy Spring tips!
- Getting up & running quickly with Spring Cloud Sleuth
- Spring Tip: Request header filtering in @RequestMapping
- Using Spring Boot Actuator integrations with Pivotal Cloud Foundry 1.11
- T4SD (Tips 4 Spring Devs): How to get Spring Boot REST endpoints to speak XML
- Building a Portable, Self-powering, Cloud-Connected IoT demo