0
点赞
收藏
分享

微信扫一扫

spring的P注入

潇湘落木life 2022-03-11 阅读 73
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 条评论