在我的applicationcontext.xml
中,我收到了以下错误:
在班级中找不到属性'dataSource'的setter 'com.bracketapp.repository.JdbcBracketDetailDao'
我查看了类和界面,并将其与没有此问题的其他人进行了比较。我没有看到这个问题。
这是完整的applicationcontext.xml
:
<!-- the parent application context definition for the springapp application -->
<bean id="productManager" class="com.springapp.service.SimpleProductManager">
<property name="productDao" ref="productDao"/>
</bean>
<bean id="productDao" class="com.springapp.repository.JdbcProductDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="academyManager" class="com.bracketapp.service.SimpleAcademyManager">
<property name="lookupObjectDao" ref="academyDao"/>
</bean>
<bean id="academyDao" class="com.bracketapp.repository.JdbcAcademyDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="ageManager" class="com.bracketapp.service.SimpleAgeManager">
<property name="lookupObjectDao" ref="ageDao"/>
</bean>
<bean id="ageDao" class="com.bracketapp.repository.JdbcAgeDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="appUserManager" class="com.bracketapp.service.SimpleAppUserManager">
<property name="appUserDao" ref="appUserDao"/>
</bean>
<bean id="appUerDao" class="com.bracketapp.repository.JdbcAppUserDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="athleteManager" class="com.bracketapp.service.SimpleAthleteManager">
<property name="athleteDao" ref="athleteDao"/>
</bean>
<bean id="athleteDao" class="com.bracketapp.repository.JdbcAthleteDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="beltManager" class="com.bracketapp.service.SimpleBeltManager">
<property name="lookupObjectDao" ref="beltDao"/>
</bean>
<bean id="beltDao" class="com.bracketapp.repository.JdbcBeltDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="bracketManager" class="com.bracketapp.service.SimpleBracketManager">
<property name="bracketDao" ref="bracketDao"/>
</bean>
<bean id="bracketao" class="com.bracketapp.repository.JdbcBracketDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="bracketDetailManager" class="com.bracketapp.service.SimpleBracketDetailManager">
<property name="bracketDetailDao" ref="bracketDetailDao"/>
</bean>
<bean id="bracketDetailDao" class="com.bracketapp.repository.JdbcBracketDetailDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="eventManager" class="com.bracketapp.service.SimpleEventManager">
<property name="lookupObjectDao" ref="eventDao"/>
</bean>
<bean id="eventDao" class="com.bracketapp.repository.JdbcEventDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="resultManager" class="com.bracketapp.service.SimpleResultManager">
<property name="resultDao" ref="resultDao"/>
</bean>
<bean id="resultDao" class="com.bracketapp.repository.JdbcResultDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="weightManager" class="com.bracketapp.service.SimpleWeightManager">
<property name="lookupObjectDao" ref="weightDao"/>
</bean>
<bean id="weightDao" class="com.bracketapp.repository.JdbcWeightDao">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<aop:config>
<aop:advisor pointcut="execution(* *..ProductManager.*(..))" advice-ref="txAdvice1"/>
<aop:advisor pointcut="execution(* com.bracketapp.service.*Manager.*(..))" advice-ref="txAdvice2"/>
</aop:config>
<tx:advice id="txAdvice1">
<tx:attributes>
<tx:method name="save*"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<tx:advice id="txAdvice2">
<tx:attributes>
<tx:method name="create*"/>
<tx:method name="update*"/>
<tx:method name="delete*"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
</bean>
答案 0 :(得分:0)
您的JdbcBracketDetailDao是否扩展了JdbcDaoSupport或NamedParameterJdbcDaoSupport?
这两个类都免费提供一个setDataSource。