[ 
https://issues.apache.org/activemq/browse/SM-1300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42179#action_42179
 ] 

Guillaume Nodet commented on SM-1300:
-------------------------------------

Could you set up a junit test case for servicemix-bean so that we can fix this 
issue faster ?

> Spring resources are not injected for every instance when using beanName 
> attribute in smx-bean endpoint
> -------------------------------------------------------------------------------------------------------
>
>                 Key: SM-1300
>                 URL: https://issues.apache.org/activemq/browse/SM-1300
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-bean
>    Affects Versions: 3.2
>         Environment: Tests done with jdk 1.6.003
>            Reporter: Fabrice Landrodie
>
> I use the beanName notation to define an endpoint in smx-bean to be able to 
> have an instance of my object per request.
> In the spring definition of the bean, I add some properties that should be 
> injected at instantiation.
> Here is the xbean.xml :
> {code:xml} 
> <bean:endpoint service="example:MyService" endpoint="myEndpoint" 
> beanName="myBeanName" />
> <bean id="myBean" name="myBeanName" class="com.examples.MyBean">
>     <property name="myProp" value="5" />
>     <property name="requestModel" value="classpath:Request.xsd" />
> </bean>
> {code} 
> The properties are well injected during startup of the service unit.
> When a new request comes on this endpoint, a new instance is created by 
> BeanEnpoint (I can see my log in the bean constructor class) but the 
> properties are not injected in this new instance, so that my code crashes 
> with a NullPointerException.
> So it seems that when creating a new instance, Spring does not inject 
> resources.
> It works when using bean="#myBean" attribut in the endpoint, but the bean is 
> then a single instance created at startup (injection done at this moment).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to