问题:使用Spring进行属性注入时constructor-arg无法出现name属性
原因:是配置文件版本低导致
解决:将
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
改为:
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="beanFactory" class="com.it.spring.demo2.BeanFactory1"/>
即可解决。