Skip to content

ChainedTransactionManagerPostProcessor applied too early #10824

Closed
@zyro23

Description

@zyro23

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. run sample app
  2. see the bootstrap assertion fail

Expected Behaviour

the ChainedTransactionManagerPostProcessor should have been applied and the transactionManager should be instanceof ChainedTransactionManager

Actual Behaviour

org.codehaus.groovy.runtime.powerassert.PowerAssertionError:
assert transactionManager in ChainedTransactionManager
       |                  |
       |                  false
       org.grails.orm.hibernate.GrailsHibernateTransactionManager@1ff542a3

the transactionManager is still a GrailsHibernateTransactionManager.

if you debug into the ChainedTransactionManagerPostProcessor, you can see that it when it runs, there is only one transactionManager bean definition, so it is not applied.

reason is likely, that both the ChainedTransactionManagerPostProcessor and the HibernateDatastoreConnectionSourcesRegistrar (which is responsible for creating the secondary transaction managers) are BeanDefinitionRegistryPostProcessors, but only the ChainedTransactionManagerPostProcessor implements Ordered (with Order.HIGHEST_PRECEDENCE), so it runs first.

i guess the HibernateDatastoreConnectionSourcesRegistrar should also be Ordered and the order of ChainedTransactionManagerPostProcessor should be lower than that?

Environment Information

  • Operating System: win x64
  • Grails Version: 3.3.1, gorm-6.1.7
  • JDK Version: oracle 8u131
  • Container Version (If Applicable): n/a

Example Application

will be referenced in a minute

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions