在一个springmvc(spring是3.0版本,其对应的thyemleaf也应该是spring3的版本)项目中添加thyemleaf时候,出现这个错误,
Cannot convert value of type [org.apache.shiro.cache.ehcache.EhCacheManager] to required type [org.thymeleaf.cache.ICacheManager] for property 'cacheManager': no matching editors or conversion strategy found
初看这个错误,从字面意思来看,感觉是对于cacheManager这个属性,没法将[org.apache.shiro.cache.ehcache.EhCacheManager]转换成[org.thymeleaf.cache.ICacheManager] for property 'cacheManager',
于是查看配置文件,发现cacheManager这个属性只有在配置shrio时候用到了
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<property name="sessionManager" ref="sessionManager"/>
<property name="authenticator" ref="authenticator"/>
<property name="cacheManager" ref="cacheManager"/>
<property name="realms">
<array>
<ref bean="ticketRealm"/>
</array>
</property>
</bean>
<bean id="cacheManager" class="org.apache.shiro.cache.ehcache.EhCacheManager">
<property name="cacheManagerConfigFile" value="classpath:com/jdjr/ft/sso/api/ehcache/ehcache.xml"/>
</bean>
所以我猜测应该是thyemleaf中有个属性也叫cacheManager,由于在这里注册了bean,所以这个属性先去spring容器里面拿来用了,于是百度,终于找到了这篇文章https://blog.csdn.net/baokx/article/details/50470908,按照博主给的参考,给出了解决方法1,即直接把cacheManager拿到securityManager内部来,发现项目正常启动
<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
<