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
ConstructorDescriptionClasspathScanningPersistenceUnitPostProcessor
(String basePackage) Creates a newClasspathScanningPersistenceUnitPostProcessor
using the given base package as scan base. -
Method Summary
Modifier and TypeMethodDescriptionvoid
postProcessPersistenceUnitInfo
(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui) void
setEnvironment
(org.springframework.core.env.Environment environment) void
setMappingFileNamePattern
(String mappingFilePattern) Configures the file name pattern JPA entity mapping files shall scanned from the classpath.void
setResourceLoader
(org.springframework.core.io.ResourceLoader resourceLoader)
-
Constructor Details
-
ClasspathScanningPersistenceUnitPostProcessor
Creates a newClasspathScanningPersistenceUnitPostProcessor
using 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:
setResourceLoader
in interfaceorg.springframework.context.ResourceLoaderAware
-
setEnvironment
public void setEnvironment(org.springframework.core.env.Environment environment) - Specified by:
setEnvironment
in interfaceorg.springframework.context.EnvironmentAware
-
postProcessPersistenceUnitInfo
public void postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui) - Specified by:
postProcessPersistenceUnitInfo
in interfaceorg.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor
-