版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wangzhengqu/article/details/88940665
问题:使用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"/>
即可解决。