其他分享
首页 > 其他分享> > xml文件中出现The prefix “p“ for attribute “p:name“ associated with an element type “bean“ is not bound报错

xml文件中出现The prefix “p“ for attribute “p:name“ associated with an element type “bean“ is not bound报错

作者:互联网

报错的主要原因:引用了spEL表达式,但没有引用相应的包

解决方法:

在bean.xml 中添加 xmlns:p="http://www.springframework.org/schema/p"即可

修改后代码如下:

<?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:util="http://www.springframework.org/schema/util"
 xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util 
http://www.springframework.org/schema/util/spring-util-4.0.xsd">
 
 <bean id="u1" p:name="张三丰" abstract="true"/>

<bean id="u2" class="com.chinasofti.extend.User" parent="u1"></bean>

</beans>

标签:xml,www,associated,springframework,util,报错,org,http,schema
来源: https://blog.csdn.net/fyyaim/article/details/120204587