Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodCachePointCut' defined in ServletContext resource [/WEB-INF/applicationContext-cache.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice': no matching editors or conversion strategy found Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are: PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice': no matching editors or conversion strategy found Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice': no matching editors or conversion strategy found at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231) at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:815) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) 配置的时候报错
我都配好了报了个错,实在找不出啊org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'defaultCacheManager': Bean with name 'defaultCacheManager' has been injected into other beans [ehCache] in its raw version as part of a circular reference, but has eventually been wrapped (for example as part of auto-proxy creation). This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodCachePointCut' defined in ServletContext resource [/WEB-INF/applicationContext-cache.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice': no matching editors or conversion strategy found
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:
PropertyAccessException 1:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [org.sell.common.util.MethodCacheInterceptor] to required type [org.aopalliance.aop.Advice] for property 'advice': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:815)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
配置的时候报错
<?xml version="1.0" encoding="UTF-8"?>
<ehcache>
<diskStore path="java.io.tmpdir"/>
<cache name="org.taha.cache.METHOD_CACHE"
maxElementsInMemory="300"
eternal="false"
timeToIdleSeconds="500"
timeToLiveSeconds="500"
overflowToDisk="true"
/>
</ehcache>
bean.xml
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation">
<value>classpath:ehcache.xml</value>
</property>
</bean><bean id="methodCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager">
<ref local="cacheManager"/>
</property>
<property name="cacheName">
<value>org.taha.cache.METHOD_CACHE</value>
</property>
</bean>
使用 MethodCacheInterceptor下面摘录了怎样配置 MethodCacheInterceptor: <bean id="methodCacheInterceptor" class="org.taha.interceptor.MethodCacheInterceptor">
<property name="cache">
<ref local="methodCache" />
</property>
</bean><bean id="methodCachePointCut" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="advice">
<ref local="methodCacheInterceptor"/>
</property>
<property name="patterns">
<list>
<value>.*methodOne</value>
<value>.*methodTwo</value>
</list>
</property>
</bean><bean id="myBean" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="org.taha.beans.MyBean"/>
</property>
<property name="interceptorNames">
<list>
<value>methodCachePointCut</value>
</list>
</property>
</bean>
<!-- 引用ehCache的配置 -->
<bean id="defaultCacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocation">
<value>classpath:ehcache.xml</value>
</property>
</bean>
<!-- 定义ehCache的工厂,并设置所使用的Cache name -->
<bean id="ehCache"
class="org.springframework.cache.ehcache.EhCacheFactoryBean">
<property name="cacheManager">
<ref local="defaultCacheManager" />
</property>
<property name="cacheName">
<value>DEFAULT_CACHE</value>
</property>
</bean>
<!-- find/create cache拦截器 -->
<bean id="methodCacheInterceptor"
class="org.sell.common.util.MethodCacheInterceptor">
<property name="cache">
<ref local="ehCache" />
</property>
</bean>
<!-- flush cache拦截器 -->
<bean id="methodCacheAfterAdvice"
class="org.sell.common.util.MethodCacheAfterAdvice">
<property name="cache">
<ref local="ehCache" />
</property>
</bean>
<bean id="methodCachePointCut"
class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="advice">
<ref local="methodCacheInterceptor" />
</property>
<property name="patterns">
<list>
<value>.*find.*</value>
<value>.*get.*</value>
</list>
</property>
</bean>
<bean id="methodCachePointCutAdvice"
class="org.springframework.aop.support.RegexpMethodPointcutAdvisor">
<property name="advice">
<ref local="methodCacheAfterAdvice" />
</property>
<property name="patterns">
<list>
<value>.*create.*</value>
<value>.*save.*</value>
<value>.*insert.*</value>
<value>.*update.*</value>
<value>.*delete.*</value>
<value>.*remove.*</value>
</list>
</property>
</bean>
Error creating bean with name 'defaultCacheManager':
Bean with name 'defaultCacheManager' has been injected into other beans [ehCache] in its raw version as part of a circular reference, but has eventually been wrapped (for example as part of auto-proxy creation). This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.