The project I'm working on uses Spring, but neither Spring-boot nor Spring-MVC. The following solution may not be as automagic as the actuator with boot, but it exposes the endpoints in a pretty succinct way.
Basically, all actuator endpoints are just beans, so you can create a new component and autowire in the endpoints however you see fit.
The only additional dependencies in my pom are spring-boot-actuator and spring-webmvc:
org.springframework.boot
spring-boot-actuator
1.2.1.RELEASE
org.springframework
spring-webmvc
4.1.4.RELEASE
Then all you need to do is create a single component class (maybe register it if you need to). Make sure to annotate with @EnableAutoConfiguration:
@Component
@EnableAutoConfiguration
@Path("/actuator/")
public class ActuatorResource {
private ObjectMapper mapper = new ObjectMapper();
@Autowired
private DumpEndpoint dumpEndpoint;
@GET
@Produces("application/json")
@Path("/dump")
@Transactional(readOnly = true)
public String getDump() throws JsonProcessingException {
return mapper.writeValueAsString(dumpEndpoint.invoke());
}
@Autowired
private EnvironmentEndpoint envEndpoint;
@GET
@Produces("application/json")
@Path("/environment")
@Transactional(readOnly = true)
public String getEnvironment() throws JsonProcessingException {
return mapper.writeValueAsString(envEndpoint.invoke());
}
}