Loading…
Overstock TechKno 2021 has ended
Welcome, TechKno 2021 Attendees!
  • If you didn’t get a chance to place your swag order the store is now OPEN! Please use the link here to get to the online swag store. Quantities are very limited so be sure to get your swag before it runs out!  


Thursday, September 23 • 2:00pm - 2:50pm
Spring Framework's Dynamic Factory Pattern - An alternative to large switch/case statements.

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!


How many cases does your factory switch statement have?
We often have to create beans that are very similar, but slightly different. Therefore we create a factory with a switch statement that checks qualification against a specific value to return the correct bean, or route execution to the correct service. Since our systems are complex our case qualifiers can be extensive! This factory pattern additionally REQUIRES injection in order to couple the bean/service with the factory. All of this translates to a lot of maintenance, and unnecessary overhead. If we want to appropriately organize our code and manage our beans we need a better solution...
We will show you how to leverage Spring Framework's ServiceLocatorFactoryBean to decouple the factory dependencies, and dynamically determine at runtime which bean or service to utilize with minimal configuration, and we will also show you how to unit test the factory.


Thursday September 23, 2021 2:00pm - 2:50pm MDT
TBA