I'm creating a spring boot application A, using annotations and XML configuration both and config-starter-config to fetch the application properties from config-server. Application is having XML beans file importing other beans XML from the imported module B.
As soon as, I'm adding spring-cloud-starter-config, the application fails to resolve the properties getting used by the module B. Even able to fetch the properties properly from the config-server.
Error:
o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'connectionName' defined in URL [jar:file:/C:/Subscriber.jar!/BOOT-INF/lib/IF.jar!/META-INF/jms-config-ref.xml]: Invocation of init method failed; nested exception is javax.naming.NoInitialContextException: Cannot instantiate class: ${InitialContext} [Root exception is java.lang.ClassNotFoundException: ${InitialContext}]
When creating a setup to run the application without spring-cloud-starter-config and providing properties from application.properties
then it works fine.
Update: The main xml is getting loaded using
@ImportResource("classpath:spring-sub-config.xml")
And the starting content inside
<beans .. xsd ns ..>
<context:property-placeholder location="file:///${CONFIG_PATH}/Subscriber.properties"/>
<context:component-scan base-package="com.sub, com.inte" />
<import resource="classpath:META-INF/inte-cmn-ref.xml" />
<import resource="classpath:META-INF/jms-config-ref.xml" />
...
</beans>
I want these beans to resolve the properties pulled from config-server.
Any suggestions, how we can make the initialization of Bean creation exception on non-lazy FactoryBean lazy.
PS: I've already tried lazy-init="true"
property.