Hi
On 12/11/12 15:49, Sébastien Lorber wrote:
Hello,


I have a problem to declare a JAXRS server with different "serviceBeans"
for each Spring env.
What i'd like is do something like that:

<jaxrs:server id="jaxrsServer" address="/service1">
   <jaxrs:serviceBeans>
     <beans profile="dev">
       <ref bean="serviceBean1" />
       <ref bean="serviceBean2" />
     </beans>
     <beans profile="prod">
       <ref bean="serviceBean2" />
       <ref bean="serviceBean3" />
     </beans>
   </jaxrs:serviceBeans></jaxrs:server>

It is not possible to do so, and I'd like to avoid duplicating the whole
jaxRS config.

Interesting, I've never heard of Spring profiles before...
What happens in the above case, is it a validation error which is reported ?


I have tried to reference a list:

   <bean id="serviceBeansList" class="java.util.ArrayList">
     <constructor-arg>
       <list>
         <ref bean="serviceBean1"/>
         <ref bean="serviceBean2"/>
       </list>
     </constructor-arg>
   </bean>
<jaxrs:server id="jaxrsServer" address="/service1">
   <jaxrs:serviceBeans>
       <ref bean="serviceBeansList" />
   </jaxrs:serviceBeans></jaxrs:server>


But it doesn't work because the namespace parser seems to always look for a
list.
org.apache.cxf.jaxrs.blueprint.JAXRSServerFactoryBeanDefinitionParser#mapElement
So it doesn't find "2 service beans" but it finds "1 arraylist" and the
list is not flattened.

Any idea?

Is there a better, more correct way to link to a list of beans in Spring, or is something like

<ref bean="serviceBeansList" />

the only way to do it ?


My original SO question:
http://stackoverflow.com/questions/13344564/using-spring-profiles-inside-a-namespace


I'd like to keep going with the namespace without having to create my own
factorybeans.


I'd like to explore what has to be done for the Spring profiles to work better

Cheers, Sergey


Thanks!



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Reply via email to