我程序中使用的beans标签的属性是:
<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"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
每个属性指定的原因和内容是什么?
最佳答案
那些是 namespace 声明。理想情况下,xml 中的每个元素都必须绑定(bind)到特定的模式。如果您想使用 AOP、事务等多个 Spring 功能,则需要这些属性。
请阅读here用于 XML 架构和命名空间
关于java - 为什么 applicationContext.xml 中需要 <beans> 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23423517/