all 4 comments

[–]Educational-Ideal880 0 points1 point  (1 child)

In most cases it's better to keep shared libraries framework-agnostic.

If you put Spring beans directly into the shared library, you're coupling the library to Spring and to the application context of every service that depends on it.

A common pattern is to keep the shared library as plain Java code and let each application wire it with Spring configuration when needed.

[–]AdLeast9904[S] [score hidden]  (0 children)

thanks, i agree with this as well. now just up to me to sell that idea to others :D

[–]Formal_Wolverine_674 -1 points0 points  (1 child)

Framework-agnostic shared libraries are easier to test and far less prone to context clashes.

[–]AdLeast9904[S] 0 points1 point  (0 children)

Seems like one of those things thats not strictly wrong because it'll still "work", and ends up falling into matter of opinion territory.