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>
测试结果