将春豆注入泽西2的最佳方法是什么?泽西岛似乎不支持这种本土化.
将2个框架连接在一起需要什么?在pom.xml和web.xml中?
我无法弄清楚为什么 My Jersey RESTful 入口点找不到我在应用服务器启动时配置的 Spring Bean。尝试后,它不断收到 NullPointerException
网页.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext*.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.testing.resource</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-serlvet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)
弹簧上下文.xml
<context:annotation-config />
<context:component-scan base-package="com.testing.config, com.testing.repository, com.testing.workflow" />
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:jdbc.properties</value>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
Jersey servlet 入口点
@Component
@Produces(MediaType.APPLICATION_JSON)
@Path("/{userId}/items")
public class …Run Code Online (Sandbox Code Playgroud)