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:
@Configuration
//@ComponentScan(basePackageClasses = ...)
public class AppConfig {
//beans @Bean
}
applicationContext.xml:
<beans>
<context:component-scan base-package="..."/>
<jaxws:endpoint ... />
</bean>
Problem: I would like to define @ComponentScan
by annotation only to have typesafety. But if I do so, the scanning is not performed. In contrast, when I use <context:component-scan..
everything works fine.
Is Spring
component scanning within a webserver tied to configuration with xml for the package scanning?
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 {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With