簡體   English   中英

自定義實體不會在Spring Cloud Dataflow Server中加載

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM