micronaut-core
micronaut-core copied to clipboard
ApplicationContext.getBeansOfType returns duplicate references to same instance
Expected Behavior
micronaut-groovy
PR 365: "fix(deps): update micronautversion to v3.6.0" is failing due to a broken test GormConfigSpec
in the hibernate-gorm
subproject.
It should pass, and has for versions up micronaut 3.5.
Actual Behaviour
Starting with Micronaut 3.5, GormConfigSpec."verity PlatformTransactionManager is qualified with name hibernate"()
fails at line 66 where it calls applicationContext.getBeansOfType(PlatformTransactionManager).size() == 2
and the result is 4
instead of 2
.
The call to applicationContext.getBeansOfType(PlatformTransactionManager)
results in three references to the same instance of PlatformTransactionManager
instead of one. The following is a copy of evaluating the statement debugging the test case. Note the three copies of GrailsHibernateTransactionManager
with the same address.
result = {ArrayList@11553} size = 4
0 = {MockPlatformTransactionManager@11556}
1 = {GrailsHibernateTransactionManager@11557}
2 = {GrailsHibernateTransactionManager@11557}
3 = {GrailsHibernateTransactionManager@11557}
Steps To Reproduce
Clone the branch at https://github.com/micronaut-projects/micronaut-groovy/tree/renovate/micronautversion
Execute the task :hibernate-gorm:test
or just run the GormConfigSpec
Setting micronautVersion
to 3.4.4 or less works
Setting micronautVersion
to 3.5.0 or later fails
Environment Information
macOS 12.5 JDK 11 or 17 (I did not try 8)
Example Application
No response
Version
3.5.0+