2012-08-05 123 views
0

其中是此applicationContext.fml文件中的错误?swing应用程序,弹簧应用程序上下文错误

<?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-2.5.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> 

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" abstract="true"> 
<property name="driverClassName" value="com.mysql.jdbc.Driver"/> 
<property name="url" value="jdbc:mysql://localhost/mostra"/> 
<property name="username" value="root"/> 
<property name="password" value="*****"/> 
</bean> 


<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
<property name="dataSource" ref="dataSource"/> 
<property name="mappingResources"> 
<list> 
<value>./resources/employee.hbm.xml</value> 
</list> 
</property> 
<property name="hibernateProperties"> 
<value>hibernate.dialect=org.hibernate.dialect.HSQLDialect</value> 
</property> 
</bean> 

<bean id="hibernateTemplate" 
class="org.springframework.orm.hibernate3.HibernateTemplate"> 
<property name="sessionFactory"> 
<ref bean="sessionFactory"/> 
</property> 
</bean> 
</beans> 

我得到“引用的数据源豆”是无效的(抽象的或没有bean类和无工厂bean)....只是为什么?????

我使用类似的代码在联合国的其他应用程序,一切工作正常...

回答

1

可能是因为你有你的数据源定义abstract="true"

+0

删除,但仍然存在错误 – Medioman92 2012-08-05 17:16:27

+0

完全相同的错误?可能是你的旧文件仍然可以在类路径中的某个地方访问 - 如果你有日食,请尝试一个干净/刷新 – 2012-08-05 17:25:55

+0

我将项目移动到MyEclipse并且错误消失了,无论如何 – Medioman92 2012-08-05 20:59:47

相关问题