一旦我@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如何配置自己。
任何帮助是极大的赞赏!
我从我的一个属性进入了一个糟糕的策略,覆盖了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"
})