Hello,
I use jersey 2.3 and spring 3.1.
In web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/application-config.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>JerseyRESTService</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer </servlet-class>
<!-- Register resources and providers under com.amazon.geocoding.console.service package. -->
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>**.**.RestApplication
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>JerseyRESTService</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
My RestApplication.java is like this:
public class RestApplication extends ResourceConfig {
public RestApplication() {
register(RequestContextFilter.class);
//register JSON converter
register(JacksonJsonProvider.class);
//path of service packages
register(**Service.class);
}
}
In spring config file
<context:annotation-config />
<context:component-scan base-package="**.**.service"/>
In Jersey service file
@Component
@Path("/service/commons")
public class **Service {
@Autowired
private AddressClient addressClient;
but I got null pointer with addressClient.
Can you help?