@EntityScan value attribute not evaluated anymore
See original GitHub issueHello,
When upgrading to Spring Boot 1.4.0.RC1 from MS3, the value attribute of the org.springframework.boot.autoconfigure.domain.EntityScan annotation is not evaluated as expected.
This results in an exception:
@Configuration
@EntityScan(value = "my.base.entity.package")
public class PersistenceConfiguration {
//...
}
However, this works:
@Configuration
@EntityScan(basePackages = "my.base.entity.package")
public class PersistenceConfiguration {
//...
}
Exception cause is:
Caused by: java.lang.IllegalArgumentException: Not a managed type: class my.base.entity.package.MyEntity
at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:210) ~[hibernate-entitymanager-5.0.9.Final.jar:5.0.9.Final]
at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:68) ~[spring-data-jpa-1.10.2.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:67) ~[spring-data-jpa-1.10.2.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:152) ~[spring-data-jpa-1.10.2.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:99) ~[spring-data-jpa-1.10.2.RELEASE.jar:na]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81) ~[spring-data-jpa-1.10.2.RELEASE.jar:na]
From a quick debugging session, it seems to me that the evaluation of the value attribute is missing in org.springframework.boot.autoconfigure.domain.EntityScanPackages.Registrar#getPackagesToScan
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (12 by maintainers)
Top Results From Across the Web
SpringBootApplication and @ComponentScan not working ...
Spring Boot will scan all the packages and sub packages starting with the package that the @SpringBootApplication annotated class is in.
Read more >spring-projects/spring-boot - Gitter
Now when adding an @EntityScan("org.bar.entities") on that class the entities in org.foo.entities aren't detected anymore. This was a bit of a surprise.
Read more >EntityScan (Spring Boot 3.0.0 API)
Base packages to scan for entities. value() is an alias for (and mutually exclusive with) this attribute. Use basePackageClasses() for a type-safe alternative ......
Read more >Is Spring-Boot (still) not working with JSR310Converters for ...
In order to have the database (I am using H2) contain TIMESTAMP-type columns with values rather than VARBINARY-type columns with values one cannot...
Read more >Required identifier property not found for class c... - Neo4j
Of course you can also use other versions but this is the version, Spring Boot was tested with. As long as Spring Data...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@snicoll Thanks for fixing this so quick. I’ll test it on Monday on the real-world project.
If you copy-pasted persistence configuration from another project, you must set the entity scan in EntityManagerFactory manually :