I am upgrading from Java 8 to Java 11. Even Spring version used earlier was 4.x now I have upgraded to Spring 5.x
I am using camel for routes
My camel context file is as follows
<bean id="samplePriceBean"
class="com.abc.SamplePriceBean">
<constructor-arg index="0"
ref="route1" />
<constructor-arg index="1"
ref="route2" />
<constructor-arg index="2"
ref="myCamelContext" />
<constructor-arg index="3" value="route1" />
<constructor-arg index="4" value="route1" />
</bean>
<camelContext id="myCamelContext" xmlns="http://camel.apache.org/schema/spring">
<route id="listRoute" autoStartup="false">
<from
uri="file:{{abc.list}}?noop=true&" />
<to uri="direct:route1"
id="route1" />
</route>
<route id="readRoute" autoStartup="false">
<from
uri="file:{{abc.read}}?noop=true&" />
<to uri="direct:route2"
id="route2" />
</route>
</camelContext>
Now when I run the application error in console as follows
Error creating bean with name 'samplePriceBean' defined in class path resource [app-camel.xml]: Cannot resolve reference to bean 'route1' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'route1' available
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:787)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:226)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
The application is unable to resolve the routes defined in camel context
I am using JDk 11 , SPring 5.x, Apache camel 3.0.0