NullPointerException on @Autowired attribute with Jersey and Spring for REST service

前端 未结 1 1265
北海茫月
北海茫月 2021-01-13 16:38

I\'ve been development a gwt application with should have a rest service to access the database, both its own database and the other remote ones. I use Spring to better work

相关标签:
1条回答
  • 2021-01-13 17:26

    You have not created bean for customerDAO in your applicationContext.xml file. If you want to use this as bean in your CustomerServiceImpl.java, create its bean in applicationContext.xml.

    Put below code in your applicationContext.xml :

    <bean class="name.of.package.CustomerDAO" id="customerDAO">
    </bean>
    

    And Add @Component annotation on your CustomerServiceImpl.java class.

    This should work for you. For reference you can use this tutorial. Here you can better understand integration of spring and JAX-RS.

    0 讨论(0)
提交回复
热议问题