I have implemented factory pattern using ServiceLocatorFactoryBean by following this reference.
It is working fine.
I am using swagger-springMVC (SpringFox), It is also working fine.
But, when I am trying to use factory pattern along with swagger then It is throwing below exceptions,
Could not autowire field: org.test.MyProject.MyFactory org.test.MyProject.controller.MyController.myFactory; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.test.MyProject.MyFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
I have tried in all possible ways by following several resources but unable to find a solution. Can anyone please help me resolve this issue?