学习目标:
Spring 配置文件的掌握
学习内容:
基本配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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>
带p命名的配置文件:
<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">
<bean name="classic" class="com.example.ExampleBean">
<property name="email" value="[emailprotected]"/>
</bean>
<bean name="p-namespace" class="com.example.ExampleBean"
p:email="[emailprotected]"/>
</beans>
c命名空间只需要将p命名空间的约束将p改成c即可
学习时间:
2022.7.12
学习产出:
Spring基础配置文件