我遇到一些Spring配置文件的问题。在尝试使用它时,我收到消息:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: 来自文件的XML文档中的第8行 [C:\ WORK \ SOFTWARE \ SOAPUI \提取物的其余部分与 - CRUD \ productws \目标\类\ WEB-INF \ dbcontext.xml] 是无效的;嵌套异常是org.xml.sax.SAXParseException; lineNumber:8; columnNumber:74; cvc-elt.1:找不到了 宣称元素'豆类。
下面是Spring配置文件。究竟是什么问题?
TIA
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<beans xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.springframework.org/schema/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
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:database.properties</value>
<value>classpath:hibernate.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="false" />
</bean>
<bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
<property name="driverClassName" value="${database.driverClassName}" />
<property name="url" value="${database.url}" />
<property name="username" value="${database.username}" />
<property name="password" value="${database.password}" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactorybean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.apostx.ccfd.master.entities" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
<prop key="hibernate.isolation">${hibernate.isolation}</prop>
<prop key="hibernate.current_session_context_class">${hibernate.current_session_context_class}</prop>
<prop key="hibernate.transaction.factory_class">${hibernate.transaction.factory_class}</prop>
</props>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>
答案 0 :(得分:0)
似乎这解决了问题
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.4.RELEASE</version>
</dependency>