出於某種奇怪的原因,此數據源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