See https://github.com/spring-projects/spring-framework/issues/33595

Comment From: quaff

Not sure tests should be added and how, I see other configuration doesn't test @Order on @Bean method.

Comment From: wilkinsona

Thanks for the proposal. I'm not too keen on adding magic numbers for the aspects' ordering, particularly as it working correctly relies upon Framework using a particular ordering. Let's see how https://github.com/spring-projects/spring-framework/issues/33595 plays out before doing anything in Boot.

Comment From: wilkinsona

On second reading of the Framework issue, I think this is really subjective: some will argue that the current ordering is sensible will others will want the opposite. I can see both sides as it depends on whether or not you see the transaction processing as part of the method invocation. Given this, I'm going to close this one as I don't think hard-coding a different order is the right answer. Depending on what happens on the Framework side, we may want to make a different change, for example one that allows the ordering to be configurable.

Comment From: quaff

On second reading of the Framework issue, I think this is really subjective: some will argue that the current ordering is sensible will others will want the opposite. I can see both sides as it depends on whether or not you see the transaction processing as part of the method invocation. Given this, I'm going to close this one as I don't think hard-coding a different order is the right answer. Depending on what happens on the Framework side, we may want to make a different change, for example one that allows the ordering to be configurable.

It's hard-coding the default order, application always can register their own Bean to override it. Allowing configure the order is great, and please reconsider https://github.com/spring-projects/spring-boot/issues/27897

Comment From: wilkinsona

It's hard-coding the default order, application always can register their own Bean to override it.

As I said, the best ordering is subjective. Changing it may break some users so I think it's better to leave it as it is until we have a better way of users configuring their preferred order.

Allowing configure the order is great, and please reconsider https://github.com/spring-projects/spring-boot/issues/27897

We can't reconsider #27897 as the order attribute on @EnableTransactionManagement is still an int.

There's no point doing anything more here until we know what direction to head in. Let's slow down a bit and see what comes of https://github.com/spring-projects/spring-framework/issues/33595.