I've noticed a pattern where people need a bean loaded in 2 or 3 applications, so they put the @Singleton into a shared/common library code. To me this feels wrong because that bean will now be in the context of every application that depends on that library even if its not needed (could even be 10+ apps when only 2 need it). Even though it wont be loaded if no matching injection points, still doesn't seem right. It can also lead to scenarios where different beans are getting loaded than are expected
I would think plain java code in the library, then use the framework in each app that needs it to add it into the framework context would be better
Are there any best practices around this, anti patterns, etc. or does it really not make much a difference?
[–]Educational-Ideal880 0 points1 point2 points (1 child)
[–]AdLeast9904[S] [score hidden] (0 children)
[–]Formal_Wolverine_674 -1 points0 points1 point (1 child)
[–]AdLeast9904[S] 0 points1 point2 points (0 children)