看了今天老大给我们的配置文件,有的是我们经常用的<beans...>有的配置文件是<beans:bean>怎么看里边的作用

解决方案 »

  1.   

    如果一个文件的默认schema不是beans,比如webflow或jee之类的,就需要指定beans了。你可以帖一下看看。
      

  2.   

    自定义的?在看Spring源码里似乎是2.5后才支持的,原来只能用默认的。
      

  3.   

    楼主项目用的是SpringSide3.0吧?把xml贴出来我们看看,帮忙分析分析。
      

  4.   

    <beans:beans xmlns="http://www.springframework.org/schema/security"
      xmlns:beans="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-3.0.xsd
               http://www.springframework.org/schema/security 
               http://www.springframework.org/schema/security/spring-security-3.0.xsd"> 
    ......
    <beans:bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
         <beans:property name="allowIfAllAbstainDecisions" value="false" />
         <beans:property name="decisionVoters">
           <beans:list>
             <beans:bean class="org.springframework.security.access.vote.RoleVoter">
               <beans:property name="rolePrefix" value="" />
             </beans:bean>
             <beans:bean class="org.springframework.security.access.vote.AuthenticatedVoter"/>
           </beans:list>
         </beans:property>
    </beans:bean>
    .....
    这么看来好像真的是在上面定义了耶   但是起了什么作用呢
      

  5.   

    <beans:beans xmlns="http://www.springframework.org/schema/security"
      xmlns:beans="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-3.0.xsd
      http://www.springframework.org/schema/security  
      http://www.springframework.org/schema/security/spring-security-3.0.xsd">  红色字的意思就是你这个文件的默认schema为security,所以你的beans定义就需要加上前缀beans
    一般的定义文件默认都是beans,你可以仔细比较一下这个头上的定义
      

  6.   

    有点了解 了   为什么这么干呢但是 按照原来的默认的beans不好么