在Spring框架中bean配置文件中constructor-arg标签中没有name元素?

bean配置文件出现错误的依赖:

<beans
<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 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-3.0.xsd">

 

就可在:bean标签下的constructor-arg标签中添加name属性了。

posted @ 2018-10-23 15:39  CHANGEMAX  阅读(272)  评论(0)    收藏  举报