Closed en-o closed 1 month ago
This is a known issue with Spring Boot. Prefer to use @AutoConfigurationPackage
to add multiple packages to the default entity scanning.
This is a known issue with Spring Boot. Prefer to use
@AutoConfigurationPackage
to add multiple packages to the default entity scanning.
thanks
There exists JPA operations in a custom third-party JAR. If @EntityScan is used, it fails to load entities from the third-party JAR, resulting in a "Not a managed type" error. However, if @EntityScan is not used, JPA scanning in the business project will be ineffective. Upon debugging, I found that this is overridden in org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration#getPackagesToScan(). Currently, I need to append instead of override the entity scanning. I'm unsure if this is a bug or a design principle. My current approach to handling this is as follows:
Override the original class override method