Beans introduced in Apache Wink using Spring is not registered

After How to insert Spring bean in Apache Wink?

Now I am using support under spring -support, and I thought I configured everything correctly.

web.xml includes:

<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 contains:

 <bean class="org.apache.wink.spring.Registrar"> <property name="instances"> <set> <ref bean="myservice" /> </set> </property> </bean> <bean id="myservice" class="mystuff.ServiceImpl"/> 

mystuff.ServiceImpl has an @Autowired annotation that introduces other Spring stuff, and mystuff.ServiceImpl implements the JAX-RS annotated interface and itself includes the JAX-RS @Path("/services") .

I see Spring loading this stuff just fine, including the myservice bean. However, when I request my resources, I get 404 not found. When Wink starts up, I see a couple of log entries that may indicate a problem:

applicationConfigLocation property was not defined

Using application classes null named in init-param applicationConfigLocation

Did I miss something? Any tips?

0
source share
1 answer

The problem was that I misunderstood the documents.

There is Spring configuration META-INF/server/wink-core-context.xml with wink-spring-support . This registers the BeanPostProcessors that actually do the tuning and that should be referenced: contextConfigLocation .

It seemed to me that I placed my configuration there, which explains why the application did not register with Wink at startup.

0
source

All Articles