Reputation: 1192
@Path("test")
public TestResource {
@GET
public Response testGet() {
return Response.ok().build();
}
}
From the spring boot documentation, the section on JAX-RS and Jersey, "All the registered endpoints should be @Components with HTTP resource annotations (@GET etc.), e.g.". The above resource still works without the @Component annotation. What would I be breaking by leaving out the @Component annotation?
Upvotes: 2
Views: 603
Reputation: 1192
"To enable JAX-RS resources to work Spring functionality that requires proxying, such as Spring transaction management (with @Transactional), Spring Security and aspect oriented programming (such as @Aspect), the resources must themselves be managed by Spring, by annotating with @Component, @Service, @Controller or @Repository:"
Upvotes: 1