Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Component
- public class LittleServiceFactory {
- @Autowired
- private LegacyLittleService legacy;
- @Autowired
- private NewShinyLittleService newShiny;
- @Autowired
- private TheSessionScopedBean theSessionScopedBean;
- public LittleService get() {
- if (theSessionScopedBean.shouldUseLegacy()) {
- return legacy;
- }
- else {
- return newShiny;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement