java - Spring 事务 xml 模式

标签 java spring hibernate tomcat jersey

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:tx="http://www.springframework.org/schema/tx"
    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/tx
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:annotation-config />

    <tx:annotation-driven/> 
.
.
.
</beans>

我在 Spring 应用程序的 applicationContext 上有它,我在 Eclipse 上收到此错误: 引用file包含错误。有关详细信息,请右键单击“问题 View ”中的消息并选择“显示详细信息...”

最佳答案

您的应用程序上下文中缺少此行

http://www.springframework.org/schema/beans/spring-beans.xsd

请试试

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:tx="http://www.springframework.org/schema/tx"
    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.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-3.0.xsd">

    <context:annotation-config />

    <tx:annotation-driven/> 
.
.
.
</beans>

关于java - Spring 事务 xml 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23930776/

相关文章:

java - 只需写入程序名称即可在不同编辑器中运行txt文件

java - 如何在 unix 上运行 .jar 文件?

java - 尝试使用HashMap将字母与数字关联起来

java - 如何在 Spring Data Jpa 中编写接受四种参数组合的选择查询

java - EntityManager.merge() 不创建表记录

java - java应用程序中的全屏模式

java - Spring Batch 提交间隔配置不起作用

java - Spring 启动缓存不适用于@PostConstruct 或@AfterPropertiesSet

java - 在 hibernate 中保留对象时无法将枚举转换为字符串

java - 如何使用Hibernate释放连接?