Factory design patter Spring Boot double bean

You should not use @Component for abstract class, because Spring context will not be able to initialize that bean. You should remove it then.

Another thing is the way you want to implement a factory pattern here – I recommend you the way described here: https://stackoverflow.com/a/39361500/14056755, refactored version https://stackoverflow.com/a/55060326/14056755.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top