自定义实体不在Spring Cloud Dataflow Server中加载

问题描述 投票:0回答:1

一旦我@EnableDataFlowServer我的SpringBoot应用程序,我自己的自定义实体不加载。 (我得到JPA未找到您的实体时发生的'type not managed'异常)。

这些实体位于我导入的另一个Spring模块中,例如

@Import({MyDomainsModule.class})

我正在使用2.0.0.m2的Spring Cloud DataFlow。

我做过一些调试:

如果我将它添加到我的Spring Boot应用程序主类:

@EntityScan({
"com.company.mydomain.entities"
})

然后我的实体开始像往常一样加载,但随后Spring DataFlow中断。例如,每次我尝试加载UI时,我都会得到:

 |ne.jdbc.spi.SqlExceptionHelper|  Table 'dataflow.appregistration' doesn't exist 

这让我想通过简单地添加EntityScan,我打破了一些命名策略,因为表的实际名称当然是app_registration

我认为这主要是“如何在一个项目中执行基于JPA的代码的多个位置”,而不是Spring Cloud DataFlow问题。但了解修复可能需要更好地了解SCDF。我已经检查了该项目,并阅读了Spring Boot以及SCDF如何配置自己。

任何帮助是极大的赞赏!

java spring spring-boot spring-cloud-dataflow
1个回答
0
投票

我从我的一个属性进入了一个糟糕的策略,覆盖了SCDF将其添加到我的application.properties中的内容。

所以要明确,我在我的属性中设置:

spring.jpa.hibernate.naming.physical-strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
spring.jpa.hibernate.naming.implicit-strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy

然后我的SpringBoot应用程序看起来像

@SpringBootApplication(exclude = LocalDataFlowServerAutoConfiguration.class)
@Import({MyDomainModule.class})
@EnableDataFlowServer

// EnableDataFlowServer has an EntityScan, which causes ours to not be picked up!
// Look in DataFlowControllerAutoConfiguration for more information
@EntityScan({
"com.company.mydomain.entities"
})
© www.soinside.com 2019 - 2024. All rights reserved.