@Autowired is not working with jersey and spring

后端 未结 4 844
攒了一身酷
攒了一身酷 2021-01-28 09:37

When I am running test at that time @Autowired is working but when I run the web app and try to fetch data at that time its throwing null pointer exception.

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-28 09:41

    You have to wire a interface instead of class. so there are two ways:

    • To let BuyerRepo to implement one interface

    • Useing @Inject or @Resource instead of @Autowired

提交回复
热议问题