0

I want to a create bean with some of job parameters. I found one thread here but that seems to unsolved and was an old post.

<bean id="context" class="com.test.MyConfig" scope="step" >
  <property name="toDate" value="#{jobParameters['toDate']}"  />
  <property name="fromDate" value="#{jobParameters['fromDate']}"  />
</bean>

 <bean id="testId" class="com.test.SomeClass"  scope="step" >
<property name="context" ref="context" />
</bean>

And setter attribute is like below And MyConfig does not implement any interface.

MyConfig config;

public void setConfig(MyConfig config)
{
    this.config = config
}

I get an exception

 Error creating bean with name 'lazybidingProxy.anotherBean' defined in   
 class path [resource/config/spring-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportException: Failed to convert value of type 'com.sun.proxy.$Proxy17 implementing org.springframework.beans.factory.Initializing,java.io.Serializable,org.springframework.aop.scope.ScopedObject.....

 to required type[package.someClass]: no matching editors or conversion   strategy found]
Community
  • 1
  • 1
surya
  • 2,581
  • 3
  • 22
  • 34
  • please show the relevant sourcecode for the setter in "anotherBean", are you working with interfaces or concrete implementations? – Michael Pralow Feb 16 '16 at 08:35
  • thanks a lot Michael, if that implements an interface it works good (and same for setter method.), and not when its a class . Why cant it be a class, I was creating a configuration object for job parameters ? – surya Feb 17 '16 at 01:52
  • 1
    afaik it is the stepscope which interferes with the "i want a bean without interface" approach, look into http://stackoverflow.com/questions/2387431/spring-autowiring-class-vs-interface should be the same with stepscope proxies – Michael Pralow Feb 17 '16 at 07:15

0 Answers0