[英]Custom entities do not load within a Spring Cloud Dataflow Server
一旦我使用@EnableDataFlowServer我的SpringBoot应用程序,就不会加载我自己的自定义实体。 (当JPA找不到您的实体时,我会收到“非托管类型”异常)。
这些实体位于我导入的另一个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如何进行自我配置。
任何帮助是极大的赞赏!
我有一个错误的策略来自我的一个属性,它覆盖了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"
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.