Class ClasspathScanningPersistenceUnitPostProcessor
java.lang.Object
org.springframework.data.jpa.support.ClasspathScanningPersistenceUnitPostProcessor
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.EnvironmentAware,org.springframework.context.ResourceLoaderAware,org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor
public class ClasspathScanningPersistenceUnitPostProcessor
extends Object
implements org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor, org.springframework.context.ResourceLoaderAware, org.springframework.context.EnvironmentAware
PersistenceUnitPostProcessor that will scan for classes annotated with Entity or
MappedSuperclass and add them to the PersistenceUnit post processed. Beyond that
JPA XML mapping files can be scanned as well by configuring a file name pattern.- Author:
- Oliver Gierke, Thomas Darimont, Mark Paluch, David Madden
-
Constructor Summary
ConstructorsConstructorDescriptionClasspathScanningPersistenceUnitPostProcessor(String basePackage) Creates a newClasspathScanningPersistenceUnitPostProcessorusing the given base package as scan base. -
Method Summary
Modifier and TypeMethodDescriptionvoidpostProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui) voidsetEnvironment(org.springframework.core.env.Environment environment) voidsetMappingFileNamePattern(String mappingFilePattern) Configures the file name pattern JPA entity mapping files shall scanned from the classpath.voidsetResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
-
Constructor Details
-
ClasspathScanningPersistenceUnitPostProcessor
Creates a newClasspathScanningPersistenceUnitPostProcessorusing the given base package as scan base.- Parameters:
basePackage- must not be null or empty.
-
-
Method Details
-
setMappingFileNamePattern
Configures the file name pattern JPA entity mapping files shall scanned from the classpath. Lookup will use the configured base package as root.- Parameters:
mappingFilePattern- must not be null or empty.
-
setResourceLoader
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader) - Specified by:
setResourceLoaderin interfaceorg.springframework.context.ResourceLoaderAware
-
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) - Specified by:
setEnvironmentin interfaceorg.springframework.context.EnvironmentAware
-
postProcessPersistenceUnitInfo
public void postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui) - Specified by:
postProcessPersistenceUnitInfoin interfaceorg.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor
-