我在写Spring配置文件时,在beans节点中配置依赖检查是发现一个奇怪的问题,default-dependency-check压根就没这个属性,硬编码上去还是红线。我初学,请问各位有没有遇到这种情况的?

解决方案 »

  1.   

    <beans >在这个根节点中有这个属性。可能是你找错位置了。
      

  2.   

    答LS的朋友:就是在<beans>下写的。
      

  3.   

    = =!那个错误的意思貌似是你的依赖关系有问题,把spring的配置贴上来,好让大家帮你看
      

  4.   

    <beans default-dependency-check="none">有这个啊/
      

  5.   

    那我直接不谈出来,也就是我按Alt+/它弹出了:
    default-autowire-candidates=""
    default-destroy-method=""
    default-init-method=""
    default-lazy-init="false"
    default-merge="false"
    就是没有:
    default-dependency-check="none"
    请问有MyEclipse有这么智能?在写的时候就判出依赖关系有问题,从而不弹!呵呵!这个问题真让我又好气又好笑。
    下面是我的applicationContext.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <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" default-autowire="byName"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver">
    </property>
    <property name="url" value="jdbc:oracle:thin:@localhost:1521:xe">
    </property>
    <property name="username" value="gwl"></property>
    <property name="password" value="gwl"></property>
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.OracleDialect
    </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>dto/JboaClaims.hbm.xml</value>
    <value>dto/JboaClaimsType.hbm.xml</value>
    <value>dto/JboaDepartment.hbm.xml</value>
    <value>dto/JboaPosition.hbm.xml</value>
    <value>dto/JboaUser.hbm.xml</value>
    </list>
    </property>
    </bean>
    </beans>
      

  6.   


    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd" default-dependency-check="none">
    你对一下,决对有
      

  7.   

    谢谢pipi517,应该是我的版本问题。