XML配置报错

Posted almm

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了XML配置报错相关的知识,希望对你有一定的参考价值。

警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘product‘ defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field ‘categroy‘ cannot be found on object of type ‘org.springframework.beans.factory.config.BeanExpressionContext‘ - maybe not public or not valid?

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘product‘ defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field ‘categroy‘ cannot be found on object of type ‘org.springframework.beans.factory.config.BeanExpressionContext‘ - maybe not public or not valid?

 出现了如图错误警告,于是翻译了一下,说在找不到categroy,果然自己XML里面配置ref功能出错,复制粘贴对应的id和ref就不会出错了

技术图片

修改二者要一样的名称

技术图片

测试类,运行成功、

技术图片

 

以上是关于XML配置报错的主要内容,如果未能解决你的问题,请参考以下文章

关于web.xml报错问题解决

web.xml配置文件中true报错的解决方案

javaweb实训第五天下午——xml配置文件约束报错问题

mybatis读取配置文件报错:Could not find resource configuration.xml

IIS无法启动报错配置文件的XML格式不正确如何处理

关于dubbo服务的xml配置文件报错的问题