Hacker News new | ask | show | jobs
Strategy Design Patterns in Spring Boot: The Efficient Way (github.com)
2 points by thegeekyasian 1214 days ago
1 comments

I have been interviewing candidates at my company for a while, where we have been asking (experienced) candidates to provide a code-based solution. The idea is to check the code quality.

The candidates, experienced with Java and Spring, end up providing a number of if/else conditions (best they do is a switch case) to switch between strategies, which is completely okay. I felt many aren't aware of Spring Dependency Resolver. This is not an expectation from the candidates, but it felt like many "Spring Boot Experienced" engineers lacked some knowledge about it.

So I have created a sample implementation, which I believe is not redundant, that explains how to use implement Strategy and Factory patterns in Spring boot, that will allow you to just provide a new implementation and Spring will do rest of the magic.

Feel free to share any feedback, I just want to make things easier and better for fellow engineers. And like I said, stars are appreciated if you found it helpful.