Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 没有名为'的bean;交易经理';在SpringBoot JPA配置中可用_Java_Spring_Spring Boot - Fatal编程技术网

Java 没有名为'的bean;交易经理';在SpringBoot JPA配置中可用

Java 没有名为'的bean;交易经理';在SpringBoot JPA配置中可用,java,spring,spring-boot,Java,Spring,Spring Boot,据贝尔东说 如果我们使用的是Spring启动项目,并且类路径上有Spring data-*或Spring tx>依赖项,那么事务管理将在默认情况下启用 但是,我有一个错误: org.springframework.messaging.MessageHandlingException:在“MethodInvokingMessageProcessor”[org.springframework.integration.handler]中处理消息时出错。MethodInvokingMessageProc

据贝尔东说

如果我们使用的是Spring启动项目,并且类路径上有Spring data-*或Spring tx>依赖项,那么事务管理将在默认情况下启用

但是,我有一个错误:

org.springframework.messaging.MessageHandlingException:在“MethodInvokingMessageProcessor”[org.springframework.integration.handler]中处理消息时出错。MethodInvokingMessageProcessor@788f2bfc];嵌套异常为org.springframework.beans.factory.NoSuchBeanDefinitionException:没有名为“transactionManager”的bean可用:没有为限定符“transactionManager”找到匹配的transactionManager bean-限定符和bean名称都不匹配

使用这些依赖项:


org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
弹簧靴起动器artemis
org.springframework.boot
spring boot启动器集成
org.springframework.boot
弹簧启动机tomcat
假如
org.springframework.boot
弹簧起动试验
测试
org.junit.vintage
朱尼特老式发动机
org.springframework.integration
弹簧集成试验
测试
org.postgresql
postgresql
com.indra.icens
ic许可证
javax.jms
javax.jms-api
org.springframework.integration
spring集成jms
com.ibm.mq
mq
com.ibm.mq
mqjms
javax.resource
连接器
com.indra.icens.srom
ic_int_srom_通用
org.hibernate.javax.persistence
hibernate-jpa-2.1-api
application.properties:

spring.datasource.url=jdbc:postgresql://xxx/yyy
spring.datasource.username=asdasd
spring.datasource.password=werwer
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
spring.jpa.show-sql=false
ServiceConfig.java

@EnableJms
@Configuration
@ImportResource({
"classpath:/META-INF/spring/integration/main-config.xml"
})
@EnableJpaRepositories("com.nbi.conn.repository")
@EntityScan("com.nbi.conn.entities")
public class ServiceConfig {
}
怎么了?我的SpringBoot配置中缺少了什么

提前感谢您的帮助

您是否尝试像这样在配置中添加bean“transactionManager”

@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(emf);

    return transactionManager;
}
您是否尝试像这样在配置中添加bean“transactionManager”

@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
    JpaTransactionManager transactionManager = new JpaTransactionManager();
    transactionManager.setEntityManagerFactory(emf);

    return transactionManager;
}

令人惊讶,它成功了!但是,我怀疑正确的配置,因为在另一个类似的项目中,我不需要配置这个bean。谢谢,令人惊讶,它成功了!但是,我怀疑正确的配置,因为在另一个类似的项目中,我不需要配置这个bean。谢谢