出现org.springframework.cache.interceptor.CacheInterceptor#0错误(重点)

本文探讨了在Spring框架中因缓存管理器(cacheManager)未正确定义而导致的BeanCreationException异常。作者分享了其spring-servlet.xml配置文件中的错误,并提供了正确的配置示例,包括所有必需的命名空间和schemaLocation,以确保缓存组件能被正确识别。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.cache.interceptor.CacheInterceptor#0': Cannot resolve reference to bean 'cacheManager' while setting bean property 'cacheManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'cacheManager' available

 

我的spring-servlet.xml的抬头写错了

正确如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"  //之前就是导错了
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tool http://www.springframework.org/schema/tool/spring-tool.xsd http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">

 

"EL1008E: Property or field 'creNo_' cannot be found on object of type 'com.joyintech.entity.cust.CustInfo' - maybe not public or not valid?[org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:223), org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:106), org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:53), org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:412), org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:93), org.springframework.expression.spel.ast.OpPlus.getValueInternal(OpPlus.java:95), org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:114), org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:273), org.springframework.cache.interceptor.CacheOperationExpressionEvaluator.key(CacheOperationExpressionEvaluator.java:104), org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.generateKey(CacheAspectSupport.java:795), org.springframework.cache.interceptor.CacheAspectSupport.generateKey(CacheAspectSupport.java:591), org.springframework.cache.interceptor.CacheAspectSupport.performCacheEvict(CacheAspectSupport.java:508), org.springframework.cache.interceptor.CacheAspectSupport.processCacheEvicts(CacheAspectSupport.java:492), org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:433), org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:345), org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:64), org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186), org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAo
最新发布
08-13
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值