component-scan and @beans components inside @configuration class
Hi.
In order to minimize xml configuration I would like to define all my beans in @Configuration classes. I am using spring mvc also and in order to achieve this I defined two lines in spring-servlet.xml:
<context:component-scan base-package="xxx.yyy.config">
<context:component-scan base-package="xxx.yyy.controller">
in package xxx.yyy.controller I have all my @Controllers which are scanned successfully.
in package xxx.yyy.config I have all other beans which are created by @Bean annotation methods (inside @Configuration annotated class). For instance InternalResourceViewResolver, some other characteristic for spring mvc beans and my internal services.
The problem is that although @Configuration class is scanned (at least I think it is), @Bean methods are not and as a result I do not have my services and all other beans instantiated.
Another problem I am struggling with is that - how can I inject my services to auto-scanned @Controller classes? Shall I just use @Autowired annotation? (assuming that @Configuration class successfully instantiate them)
Thank you in advance!