spring的P注入

阅读 73

2022-03-11

P注入:
1.改约束文件在约束文件里面加入: 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">
    <!--P注入-->
<bean id="person" class="com.chen.pojo.Person" p:name="赵华" p:age="10"/>
后面的属性值如上图

精彩评论(0)

0 0 举报