java.lang.IllegalStateException: Failed to load ApplicationContext Caused by: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'cachedConnectionFactory' defined in class path resource [com/edb/fs/tac/jfr/srv/ws/infra/mq/MqConfig.class]: Cannot register bean definition [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=true; factoryBeanName=mqConfig; factoryMethodName=connectionFactory; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/edb/fs/tac/jfr/srv/ws/infra/mq/MqConfig.class]] for bean 'cachedConnectionFactory': There is already [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=camelCxfTransportTest.MockConfig; factoryMethodName=cachedConnectionFactory; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/edb/fs/tac/jfr/srv/ws/CamelCxfTransportTest$MockConfig.class]] bound.
The case:
The MqConfig has been loaded in a previous test (but the configuration class is not active for the test in which the exception is thrown.
In the test that throws the error I have an inner config class which has the connection factory as a mock:
which leads me to think that something has changed wrt test-context caching, as a bean is available to the testclass when it should not even be visible.
If I run the test-class isolated (mvn.... test=thetestclass) it will pass fine, hence I think it is due to context caching.
Affects: 5.1 RC1
The text was updated successfully, but these errors were encountered:
Can you please create a simple, scaled-down project that reproduces the error you've encountered and make that available to us (e.g., via the "issues" repo)?
David J. M. Karlsen opened SPR-17049 and commented
Found in 5.1.0-SNAPSHOT
Error Message
Failed to load ApplicationContext
Stacktrace
The case:
The MqConfig has been loaded in a previous test (but the configuration class is not active for the test in which the exception is thrown.
In the test that throws the error I have an inner config class which has the connection factory as a mock:
production-config:
which leads me to think that something has changed wrt test-context caching, as a bean is available to the testclass when it should not even be visible.
If I run the test-class isolated (mvn.... test=thetestclass) it will pass fine, hence I think it is due to context caching.
Affects: 5.1 RC1
The text was updated successfully, but these errors were encountered: