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 Details

    • ClasspathScanningPersistenceUnitPostProcessor

      public ClasspathScanningPersistenceUnitPostProcessor(String basePackage)
      Creates a new ClasspathScanningPersistenceUnitPostProcessor using the given base package as scan base.
      Parameters:
      basePackage - must not be null or empty.
  • Method Details

    • setMappingFileNamePattern

      public void setMappingFileNamePattern(String mappingFilePattern)
      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 interface org.springframework.context.ResourceLoaderAware
    • setEnvironment

      public void setEnvironment(org.springframework.core.env.Environment environment)
      Specified by:
      setEnvironment in interface org.springframework.context.EnvironmentAware
    • postProcessPersistenceUnitInfo

      public void postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui)
      Specified by:
      postProcessPersistenceUnitInfo in interface org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor