We use EhCacheManagerFactoryBean which has stopped working after upgrading spring framework versions from 4.1.6 to 4.3.27. I get BeanCreationException at application startup.
I tried by overriding the springframework dependencies to 4.1.6, and it worked. It also worked for 4.2.5 and 4.2.8. Fails for 4.3.27 and 4.3.5 (haven't tried other 4.3.x versions).
Here are my relevant pom dependencies
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.6.7</version>
</dependency>
I could isolate the problem being relevant for spring-context, spring-aop, and spring-context-support (downgraded these to 4.2.5 and kept rest at 4.3.27 - it worked.)
cache bean definition - the cacheManager bean is used as reference to define other beans,
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:shared="true" />
<bean id="abstractCache" class="<class that extends org.springframework.cache.ehcache.EhCacheFactoryBean>" p:cache-manager-ref="cacheManager" abstract="true" />
....
</beans>
Exception, Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheManager' defined in file
stacktrace, Caused by: java.lang.IllegalStateException: Singleton instance not initialized yet at org.springframework.util.Assert.state(Assert.java:70) at org.springframework.beans.factory.config.AbstractFactoryBean.getSingletonInstance(AbstractFactoryBean.java:180) at org.springframework.beans.factory.config.AbstractFactoryBean.access$200(AbstractFactoryBean.java:61) at org.springframework.beans.factory.config.AbstractFactoryBean$EarlySingletonInvocationHandler.invoke(AbstractFactoryBean.java:265) at com.sun.proxy.$Proxy20.iterator(Unknown Source) at org.springframework.cache.ehcache.EhCacheFactoryBean.afterPropertiesSet(EhCacheFactoryBean.java:291) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1677) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1615)
Appreciate any help. Thank you.