【Spring笔记】c空间和p命名空间注入

p命名空间注入:

spring中的p命名空间就是为了更加方便的使用set方法注入属性内容

 需要导入p空间的xml约束

xmlns:p="http://www.springframework.org/schema/p"

 测试结果:

c命名空间:

spring的c命名空间就是为了更加方便的使用有参构造方法注入

首先要引入对c命名空间的xml约束

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:c="http://www.springframework.org/schema/c"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd">
</beans>

 测试结果

 

猜你喜欢

转载自blog.csdn.net/m0_52043808/article/details/124387292