public class MergePersistenceUnitManager
extends org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
Modifier and Type | Field and Description |
---|---|
protected org.springframework.context.ApplicationContext |
applicationContext |
protected List<BroadleafClassTransformer> |
classTransformers |
protected EntityMarkerClassTransformer |
entityMarkerClassTransformer |
protected org.springframework.core.env.Environment |
environment |
protected org.springframework.jmx.export.MBeanExporter |
mBeanExporter |
protected Set<BroadleafClassTransformer> |
mergedClassTransformers |
protected Map<String,DataSource> |
mergedDataSources |
protected Set<String> |
mergedPersistenceXmlLocations |
protected HashMap<String,javax.persistence.spi.PersistenceUnitInfo> |
mergedPus |
protected List<QueryConfiguration> |
queryConfigurations |
protected static boolean |
transformed
This should only be used in a test context to deal with the Spring ApplicationContext refreshing between different
test classes but not needing to do a new transformation of classes every time.
|
Constructor and Description |
---|
MergePersistenceUnitManager() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addNamedQueriesToPersistenceUnits(boolean weaverRegistered) |
protected boolean |
addTransformersToPersistenceUnits()
Adds all of the configured
classTransformers to all of the persistence units |
void |
afterPropertiesSet() |
void |
configureClassTransformers() |
void |
configureMergedItems() |
protected List<String> |
detectNonTransformedClasses()
If a class happened to be loaded by the ClassLoader before we had a chance to set up our instrumentation,
it may not be in a consistent state.
|
protected boolean |
detectSpringBootDevtools()
Detects whether or not Spring Devtools is on the classpath
|
protected void |
disableSchemaCreateIfApplicable(String persistenceUnitName,
org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui) |
protected void |
exceptionIfEntityMarkerNotFound()
Detects the presence of the
EntityMarkerClassTransformer and throws an exception if this is misconfigured. |
protected void |
exceptionIfRootBeanDefinition(List<String> nonTransformedClasses)
Validates whether or not the given nonTransformedClasses are contained in the root ApplicationContext and throws an IllegalStateException if so, else this does nothing
|
protected void |
exceptionWithNonTransformed(List<String> nonTransformedClasses) |
List<BroadleafClassTransformer> |
getClassTransformers() |
protected org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo |
getMergedUnit(String persistenceUnitName,
org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo newPU) |
protected boolean |
handleClassTransformerRegistrationProblem(BroadleafClassTransformer transformer,
Exception e) |
protected boolean |
isPersistenceUnitOverrideAllowed() |
javax.persistence.spi.PersistenceUnitInfo |
obtainDefaultPersistenceUnitInfo() |
javax.persistence.spi.PersistenceUnitInfo |
obtainPersistenceUnitInfo(String persistenceUnitName) |
protected void |
postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo newPU) |
void |
preparePersistenceUnitInfos() |
void |
setClassTransformers(List<BroadleafClassTransformer> classTransformers) |
protected List<String> |
triggerClassLoadForManagedClasses()
Triggers a class load via this class's
ClassLoader for all of the classes in all of the persistence units |
getDataSourceLookup, getDefaultDataSource, getDefaultJtaDataSource, getLoadTimeWeaver, getPersistenceUnitInfo, getPersistenceUnitPostProcessors, setDataSourceLookup, setDataSources, setDefaultDataSource, setDefaultJtaDataSource, setDefaultPersistenceUnitName, setDefaultPersistenceUnitRootLocation, setLoadTimeWeaver, setMappingResources, setPackagesToScan, setPersistenceUnitPostProcessors, setPersistenceXmlLocation, setPersistenceXmlLocations, setResourceLoader, setSharedCacheMode, setValidationMode
protected List<BroadleafClassTransformer> classTransformers
protected Map<String,DataSource> mergedDataSources
protected Set<BroadleafClassTransformer> mergedClassTransformers
protected EntityMarkerClassTransformer entityMarkerClassTransformer
@Autowired(required=false) @Qualifier(value="blAutoDDLStatusExporter") protected org.springframework.jmx.export.MBeanExporter mBeanExporter
@Autowired protected org.springframework.context.ApplicationContext applicationContext
@Autowired protected org.springframework.core.env.Environment environment
@Autowired(required=false) protected List<QueryConfiguration> queryConfigurations
protected static boolean transformed
protected boolean isPersistenceUnitOverrideAllowed()
isPersistenceUnitOverrideAllowed
in class org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
@PostConstruct public void configureMergedItems()
public void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
@PostConstruct public void configureClassTransformers() throws InstantiationException, IllegalAccessException, ClassNotFoundException
protected org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo getMergedUnit(String persistenceUnitName, org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo newPU)
public void preparePersistenceUnitInfos()
preparePersistenceUnitInfos
in class org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
protected boolean addTransformersToPersistenceUnits() throws Exception
classTransformers
to all of the persistence unitsException
- if there was an undetectable problem during transformer additionprotected boolean addNamedQueriesToPersistenceUnits(boolean weaverRegistered) throws Exception
Exception
protected boolean handleClassTransformerRegistrationProblem(BroadleafClassTransformer transformer, Exception e) throws Exception
Exception
protected void exceptionWithNonTransformed(List<String> nonTransformedClasses) throws ClassNotFoundException
nonTransformedClasses
- the classes that were detected as having not been transformedClassNotFoundException
protected boolean detectSpringBootDevtools()
protected void exceptionIfRootBeanDefinition(List<String> nonTransformedClasses) throws ClassNotFoundException
nonTransformedClasses
- classes that were not detected as having undergone class transformationIllegalStateException
- if any of the nonTransformedClasses are in the root ApplicationContextClassNotFoundException
protected List<String> detectNonTransformedClasses()
protected List<String> triggerClassLoadForManagedClasses() throws ClassNotFoundException
ClassLoader
for all of the classes in all of the persistence unitsClassNotFoundException
- if there was a problem in the class loadprotected void exceptionIfEntityMarkerNotFound()
EntityMarkerClassTransformer
and throws an exception if this is misconfigured. If there
are no class transformes within mergedClassTransformers
then this does nothingprotected void postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo newPU)
postProcessPersistenceUnitInfo
in class org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
public javax.persistence.spi.PersistenceUnitInfo obtainPersistenceUnitInfo(String persistenceUnitName)
obtainPersistenceUnitInfo
in interface org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager
obtainPersistenceUnitInfo
in class org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
public javax.persistence.spi.PersistenceUnitInfo obtainDefaultPersistenceUnitInfo()
obtainDefaultPersistenceUnitInfo
in interface org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager
obtainDefaultPersistenceUnitInfo
in class org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager
public List<BroadleafClassTransformer> getClassTransformers()
public void setClassTransformers(List<BroadleafClassTransformer> classTransformers)
protected void disableSchemaCreateIfApplicable(String persistenceUnitName, org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui)
Copyright © 2022. All rights reserved.