@Autowired is not working with jersey and spring

后端 未结 4 784
攒了一身酷
攒了一身酷 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 10:05

    I Have encountered this situation, you need to add some jar file

    gradle project:

    compile group: 'org.glassfish.jersey.ext', name: 'jersey-spring3', version: '2.22.2'

    maven project:

    
        org.glassfish.jersey.ext
        jersey-spring3
        2.22.2
    
    

    another solution is web.xml file:

     
        jersey-serlvet
        com.sun.jersey.spi.spring.container.servlet.SpringServlet
        
            com.sun.jersey.config.property.packages
            cn.ice
        
        1
    
    
    
        jersey-serlvet
        /*
    
    

提交回复
热议问题