在Spring Boot中配置Hibernate以忽略某些通过依赖项导入的带有实体标记的类
在我的项目中,我使用了在Spring Boot中配置Hibernate以忽略某些通过依赖项导入的带有实体标记的类,hibernate,spring-boot,kotlin,spring-webflux,Hibernate,Spring Boot,Kotlin,Spring Webflux,在我的项目中,我使用了springbootstarterdatajpa和springbootstarterwebflux 我有各种各样的 @实体符号由hibernate正确识别,但是,在一个模块中,我依赖于项目中与Web服务器无关的另一个模块,其结构如下所示: ROOT MODULE / \ Dependency Dependant (non web app) (web app with spring boot jpa) 这个非web模块还
springbootstarterdatajpa
和springbootstarterwebflux
我有各种各样的
@实体符号由hibernate正确识别,但是,在一个模块中,我依赖于项目中与Web服务器无关的另一个模块,其结构如下所示:
ROOT MODULE
/ \
Dependency Dependant
(non web app) (web app with spring boot jpa)
这个非web模块还使用hibernate和@Entity。
在启动spring服务器时,web目录中的hibernate似乎试图加载另一个模块中标记为@Entity的类,这导致了奇怪的问题和数据泄漏
如何告诉hibernate只查看当前模块而忽略其他模块 您可以使用@EntityScan注释告诉spring在哪里可以找到您的实体。 有关和的更多详细信息