Here we have configured the spring mvc configuration. In @ComponentScan we can give the path where we have our components(like controller, model, dao etc).
For adding the single properties file we use:
@PropertySource("classpath:application.properties")
and for multiple files we use:
@PropertySources({
@PropertySource("classpath:application.properties"),
@PropertySource("classpath:mail.properties")
})
@Configuration
@EnableWebMvc
@EnableTransactionManagement
@ComponentScan(basePackages = "com.data.*")
@PropertySources({
@PropertySource("classpath:application.properties"),
@PropertySource("classpath:mail.properties")
})
public class CustomConfiguration extends WebMvcConfigurerAdapter {
//other configuration details like view resolver, data source, hibernate setting etc.
}
0 Comment(s)