Buggy code:
public class DefaultPersistenceUnitManager implements InitializingBean , ResourceLoaderAware , LoadTimeWeaverAware , PersistenceUnitManager { public static final String DEFAULT_PERSISTENCE_XML_LOCATION = "classpath*:META-INF//persistence.xml" ; public static final String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION = "classpath:" ; public static final String ORIGINAL_DEFAULT_PERSISTENCE_UNIT_NAME = "default" ; private static final String ENTITY_CLASS_RESOURCE_PATTERN = "//**//*.class" ; private static final boolean jpa2ApiPresent = ClassUtils . hasMethod ( PersistenceUnitInfo . class , "getSharedCacheMode" ) ; private static final TypeFilter [ ] entityTypeFilters = new TypeFilter [ ] { new AnnotationTypeFilter ( Entity . class , false ) , new AnnotationTypeFilter ( Embeddable . class , false ) , new AnnotationTypeFilter ( MappedSuperclass . class , false ) } ; private String [ ] persistenceXmlLocations = new String [ ] { DefaultPersistenceUnitManager . DEFAULT_PERSISTENCE_XML_LOCATION } ; private String defaultPersistenceUnitRootLocation = DefaultPersistenceUnitManager . ORIGINAL_DEFAULT_PERSISTENCE_UNIT_ROOT_LOCATION ; private String defaultPersistenceUnitName = DefaultPersistenceUnitManager . ORIGINAL_DEFAULT_PERSISTENCE_UNIT_NAME ; private String [ ] packagesToScan ; private String [ ] mappingResources ; private DataSourceLookup dataSourceLookup = new JndiDataSourceLookup ( ) ; private DataSource defaultDataSource ; private PersistenceUnitPostProcessor [ ] persistenceUnitPostProcessors ; private LoadTimeWeaver loadTimeWeaver ; private ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver ( ) ; private final Set < String > persistenceUnitInfoNames = new HashSet < String > ( ) ; private final Map < String , PersistenceUnitInfo > persistenceUnitInfos = new HashMap < String , PersistenceUnitInfo > ( ) ; public void setPersistenceXmlLocation ( String persistenceXmlLocation ) { } public void setPersistenceXmlLocations ( String ... persistenceXmlLocations ) { } public void setDefaultPersistenceUnitRootLocation ( String defaultPersistenceUnitRootLocation ) { } public void setDefaultPersistenceUnitName ( String defaultPersistenceUnitName ) { } public void setPackagesToScan ( String ... packagesToScan ) { } public void setMappingResources ( String ... mappingResources ) { } public void setDataSources ( Map < String , DataSource > dataSources ) { } public void setDataSourceLookup ( DataSourceLookup dataSourceLookup ) { } public DataSourceLookup getDataSourceLookup ( ) { } public void setDefaultDataSource ( DataSource defaultDataSource ) { } public DataSource getDefaultDataSource ( ) { } public void setPersistenceUnitPostProcessors ( PersistenceUnitPostProcessor ... postProcessors ) { } public PersistenceUnitPostProcessor [ ] getPersistenceUnitPostProcessors ( ) { } public void setLoadTimeWeaver ( LoadTimeWeaver loadTimeWeaver ) { } public LoadTimeWeaver getLoadTimeWeaver ( ) { } public void setResourceLoader ( ResourceLoader resourceLoader ) { } public void afterPropertiesSet ( ) { } public void preparePersistenceUnitInfos ( ) { } private List < SpringPersistenceUnitInfo > readPersistenceUnitInfos ( ) { } private SpringPersistenceUnitInfo buildDefaultPersistenceUnitInfo ( ) { SpringPersistenceUnitInfo scannedUnit = new SpringPersistenceUnitInfo ( ) ; scannedUnit . setPersistenceUnitName ( this . defaultPersistenceUnitName ) ; <START_BUG> scannedUnit . setExcludeUnlistedClasses ( true ) ; <END_BUG> if ( ( this . packagesToScan ) != null ) { for ( String pkg : this . packagesToScan ) { try { String pattern = ( ( ResourcePatternResolver . CLASSPATH_ALL_URL_PREFIX ) + ( ClassUtils . convertClassNameToResourcePath ( pkg ) ) ) + ( DefaultPersistenceUnitManager . ENTITY_CLASS_RESOURCE_PATTERN ) ; Resource [ ] resources = this . resourcePatternResolver . getResources ( pattern ) ; MetadataReaderFactory readerFactory = new org . springframework . core . type . classreading . CachingMetadataReaderFactory ( this . resourcePatternResolver ) ; for ( Resource resource : resources ) { if ( resource . isReadable ( ) ) { MetadataReader reader = readerFactory . getMetadataReader ( resource ) ; String className = reader . getClassMetadata ( ) . getClassName ( ) ; if ( matchesFilter ( reader , readerFactory ) ) { scannedUnit . addManagedClassName ( className ) ; } } } } catch ( IOException ex ) { throw new PersistenceException ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>scan<seq2seq4repair_space>classpath<seq2seq4repair_space>for<seq2seq4repair_space>unlisted<seq2seq4repair_space>classes" , ex ) ; } } } if ( ( this . mappingResources ) != null ) { for ( String mappingFileName : this . mappingResources ) { scannedUnit . addMappingFileName ( mappingFileName ) ; } } return scannedUnit ; } private boolean matchesFilter ( MetadataReader reader , MetadataReaderFactory readerFactory ) throws IOException { } private URL determineDefaultPersistenceUnitRootUrl ( ) { } protected final MutablePersistenceUnitInfo getPersistenceUnitInfo ( String persistenceUnitName ) { } protected void postProcessPersistenceUnitInfo ( MutablePersistenceUnitInfo pui ) { } public PersistenceUnitInfo obtainDefaultPersistenceUnitInfo ( ) { } public PersistenceUnitInfo obtainPersistenceUnitInfo ( String persistenceUnitName ) { } private static class Jpa2PersistenceUnitInfoDecorator implements InvocationHandler { private final SpringPersistenceUnitInfo target ; private final Class < ? extends Enum > sharedCacheModeEnum ; private final Class < ? extends Enum > validationModeEnum ; @ SuppressWarnings ( "unchecked" ) public Jpa2PersistenceUnitInfoDecorator ( SpringPersistenceUnitInfo target ) { } public final SpringPersistenceUnitInfo getTarget ( ) { } public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { } } }

Fix:
scannedUnit . excludeUnlistedClasses ( ) ;