Jersey and spring integration - bean Injections are null at runtime

前端 未结 1 1465
Happy的楠姐
Happy的楠姐 2021-01-03 01:07

I am trying to inject services into a Rest class that is using Jersey.

No matter what or how I try to inject into this class seems to be showing up as null at runti

1条回答
  •  难免孤独
    2021-01-03 01:48

    Try

    
         com.sun.jersey.spi.spring.container.servlet.SpringServlet
    
    

    You will also need the contextConfigLocation , but I assume you have it. See here for more details about the setup

    As matt b suggested spring instantiates your objects, but Jersey does not know anything about spring and instantiates them itself again. When you use the SpringServlet it should locate the spring application context.

    That said, spring-mvc provides support for RESTful services that is very similar to that of JAX-RS. You can try it as well.

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