亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

結合Spring項目和Jersey

結合Spring項目和Jersey

RISEBY 2019-08-23 09:25:41
結合Spring項目和Jersey我用Spring JPA構建了一個項目,現在我想在我的Jersey項目中使用它。我已將我的SJPA項目添加為我的pom.xml中的依賴項當我使用GET / POST / PUT / DELETE方法時,我想使用我的SJPA中的服務類。使用注釋有一種簡單的方法嗎?或者我必須AnnotationConfigApplicationContext參加每堂課?感覺有點浪費。@Path("/users")@Produces(MediaType.APPLICATION_JSON)@Consumes(MediaType.APPLICATION_JSON)public final class UserResource{     private AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();     private PodcastService service;     @GET     public Response getAllPodcasts() {         context.scan("org.villy.spring.service");         context.refresh();         service= context.getBean(PodcastService.class);         return Response.ok(service.findAll()).build();     }}
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 547 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號