出于某种奇怪的原因,此数据源bean在我的dao-beans中找到3个,但没有在其他名称中找到(例如Spring-name1)。有什么不同?未找到引用的bean'名称'
引用豆 '数据源' 未找到
这是代码:
不工作豆(春季名1):
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="cheopsDAO" class="se.kth.domain.dao.impl.JdbcCheopsDAO">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
工作豆(春季名2 ):
<?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:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="thresholdDAO" class="se.kth.domain.dao.impl.JdbcThresholdDAO">
<property name="dataSource" ref="dataSource" />
</bean>
</beans>
自旋微观-Module.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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<import resource="database/Spring-Datasource.xml" />
<import resource="dao-beans/**" />
</beans>
弹簧Datasource.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans">
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource"
id="dataSource">
<property value="com.mysql.jdbc.Driver" name="driverClassName" />
<property value="jdbc:mysql://localhost:3306/test" name="url" />
<property value="root" name="username" />
<property value="test" name="password" />
</bean>
</beans>
我已经在各自的包所需的DAO文件corretly,为什么是第二个工作,但不是第一个?没有区别..
非常感谢!
有什么改变,你导入死的文件直接没有whildcard? – 2015-02-05 13:04:04
咦?对不起你的意思是什么?什么是通配符和什么导入?我最近没有创建它们,他们曾经工作,现在一些他们停止这样做.. – benskiiii 2015-02-05 13:06:55
你把文件移动到不同的位置? (我猜猜spring-name1和spring-name2是在同一个地方,并以相同的方式导入) – Thenanox 2015-02-05 13:07:42