继如何将 Spring bean 注入 Apache Wink?
我现在正在使用 wink-spring-support 并且我认为我的设置正确。
web.xml 包括:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:META-INF/wink/wink-core-context.xml
classpath:applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>restServlet</servlet-name>
<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>restServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
META-INF/wink/wink-core-context.xml 包含:
<bean class="org.apache.wink.spring.Registrar">
<property name="instances">
<set>
<ref bean="myservice" />
</set>
</property>
</bean>
<bean id="myservice" class="mystuff.ServiceImpl"/>
有一个@Autowired注解mystuff.ServiceImpl注入了其他 Spring 东西,并mystuff.ServiceImpl实现了一个 JAX-RS 注解接口,并且它本身包含一个 JAX-RS@Path("/services")注解。
我可以看到 Spring 很好地加载了这些东西,包括myservicebean。但是,当我请求我的资源时,我得到一个 404 未找到。当 Wink 启动时,我可以看到一些可能表明问题的日志条目:
applicationConfigLocation property was not defined
Using application classes null named in init-param applicationConfigLocation
我在某个地方错过了什么吗?有什么建议吗?