Spring with CXF Rest (Does hippo use different applicationContextes?)

28 views
Skip to first unread message

koev

unread,
Oct 29, 2015, 6:19:32 AM10/29/15
to Hippo Community
Hi,

I am about to configure a REST Service using the docs at http://www.onehippo.org/library/concepts/rest/restful-api-support---plain-jax-rs-services.html

I am  using Spring for my components, services etc. which are defined in an applicationContext.xml in the WEB-INF folder (referenced within the web.xml)

so in the WEB-INF/applicationContext.xml I have sth like this
<context:component-scan
base-package="de.xxx.....

which also include the RestServiceClass "ValidationResource" (which is annotated with @Component)

in the META-INF.hst-assembly.overrides/custom-jaxrs-resources.xml I have sth like this
<bean id="customRestPlainResourceProviders"
class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
<bean class="org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider">
<constructor-arg>
<ref bean="validationResource" />
<!--<bean class="de.xxx.ValidationResource" />-->
</constructor-arg>
</bean>
</list>
</property>
</bean>

Unfortunately Spring does not find the Spring Bean "validationResource".

I really want to use the @Autowiring in the RestServices to get rid of any
WebApplicationContextUtils.getWebApplicationContext(servletContext).getBean()

I also tried to move my applicationContext.xml into the assembly-overrides folder which concludes in a loaded ValidationResource Bean (so far so good). But Autowiring stil doesn't work even with

@PostConstruct
public void init() {
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}


Does any one has an idea on this ?

Reply all
Reply to author
Forward
0 new messages