- Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Affects: <6.0.4>
When upgrading from spring-core-5.3.24.jar to spring-core-6.0.4.jar (spring-boot 2 to 3 upgrade)
Our test uses persistence.xml
descriptions for persistence units. The test fails for a duplicated persistence unit.
main cause found in debugger:
the set created at org.springframework.core.io.support.PathMatchingResourcePatternResolver#getResources line 325 with one element returned by findAllModulePathResources(locationPatternWithoutPrefix)
:
- a
org.springframework.core.io.FileSystemResource
whose Path (its hash source material) is/C:/SomePath/target/test-classes/META-INF/persistence.xml
then the set is completed line 332 by the result of findAllClassPathResources(locationPatternWithoutPrefix)
, which returns the same resource as the old version (spring-core-5.3.24):
- an
org.springframework.core.io.UrlResource
whose getCleanedUrl() (its hash source material) isfile:/C:/SomePath/target/test-classes/META-INF/persistence.xml
(notice thefile:
prefix)
The found resources are the same file resource in 2 different Java structures, but their hash being solved differently, they both are added to the set, and therefore this resource conflicts with itself.
Consequence:
the method org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager#preparePersistenceUnitInfos fails the test at line 470 because the persistence units are duplicated (but they come from the same source).