How to configure component-scan by annotation only in Spring?

后端 未结 1 1975
执笔经年
执笔经年 2021-01-04 05:41

I\'m running a war file on a tomcat webserver environment.

I have an annotation based config for @Beans, and a xml config for webservices:



        
相关标签:
1条回答
  • 2021-01-04 06:20

    Go through http://docs.spring.io/spring-javaconfig/docs/1.0.0.M4/reference/html/ch06s02.html Something Like.

        @Configuration
        @ComponentScan("com.company") // search the com.company package for @Component classes
        @ImportXml("classpath:com/company/data-access-config.xml")        
        public class Config {
        }
    
    0 讨论(0)
提交回复
热议问题