文件头注入2行即可用
xmlns:p="http://www.springframework.org/schema/p"
xmlns:c="http://www.springframework.org/schema/c"
<?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"
xmlns:c="http://www.springframework.org/schema/c"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd">
<!--C构造器,P属性,C/P命名空间注入-->
<bean id="User1" class="com.liu.pojo.User" p:age="18" p:name="小明"></bean>
<bean id="User2" class="com.liu.pojo.User" c:age="19" c:name="大明"></bean>
</beans>