The prefix "p" for attribute "p:message" associated with an element type "bean"

报错的主要原因是因为,引用了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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="helloWorld" class="com.zjf.test.HelloWorld"
p:message="saynow" ></bean>

</beans>

原文地址:https://www.cnblogs.com/zjf6666/p/9675375.html