![](/img/trans.png)
[英]Difference between spring-boot-starter-web and spring-boot-starter-web-services and spring-boot-starter-jersey
[英]Purpose of @Component annotation on spring-boot-starter-jersey resources in Spring boot
@Path("test")
public TestResource {
@GET
public Response testGet() {
return Response.ok().build();
}
}
從Spring Boot文檔的JAX-RS和Jersey上的部分開始,“例如,所有注冊的端點都應該是具有HTTP資源注釋的@Components(@GET等)”。 上面的資源仍然可以在沒有@Component注釋的情況下使用。 省略@Component注釋會破壞什么?
“要使JAX-RS資源能夠運行需要代理的Spring功能,例如Spring事務管理(使用@Transactional),Spring Security和面向方面的編程(例如@Aspect),這些資源本身必須由Spring通過注釋來管理@ Component,@ Service,@ Controller或@Repository:”
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.