Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the orthogonal concern in Spring Framework?

Tags:

java

spring

Documentation is here!

You can declare the @Order annotation at the target class level and on @Bean methods, potentially for individual bean definitions (in case of multiple definitions that use the same bean class). @Order values may influence priorities at injection points, but be aware that they do not influence singleton startup order, which is an orthogonal concern determined by dependency relationships and @DependsOn declarations.

I think I understand "orthogonal concern", Changing A does not change B, just like Functional Programming, such as pure function.

I just started learning the Spring framework, so I'm not very familiar with some concepts.

I have these ideas about orthogonal concerns, These ideas could be completely wrong, and I would appreciate it if you could point out my mistakes and let me know what concepts I might be missing.

If Bean B depends on Bean A, will Bean B be affected if Bean A undergoes changes? I think Bean B will be affect, but (I think) this goes against orthogonal concerns.

Or if they have a dependency relationship, are they considered as a whole? If that's the case, then it wouldn't violate orthogonal concerns.

It would be even better if you could provide some examples!

like image 745
OnlyWick Avatar asked Dec 06 '25 07:12

OnlyWick


1 Answers

The way I see it, an "orthogonal concern" is not a specifically Spring concept. I think the documentation here uses the idiom as meaning that the priorities determined when loading beans are distinct from the order in which beans are loaded by the Spring context. From http://veryfancy.net/blog/orthogonal-concerns/ :

When a programmer refers to two factors as “orthogonal concerns”, it means that a change with regard to one factor doesn’t affect the other. We use the term “orthogonal” to mean something like “independent” or “unrelated”.

What this means is that using the @Order annotation on beans will change the priority in which beans are used, and not the literal order in which they are loaded by the Spring framework.

like image 175
Chris Neve Avatar answered Dec 08 '25 20:12

Chris Neve



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!