I\'m setting my properties in app-servlet.xml with a bean like this:
classpath:mongodb.remote.properties
/WEB-INF/mongodb.remote.properties
----------------------------------------------------------------------------------------
If you have for example this package : com.profile.config, com.profile.controller, ecc..
it's not problem if you put only com.profile, it's ok !!! Now
@Configuration
@ComponentScan(basePackages = "com.profile")
/** resources folder & default package maven project*/
@PropertySource(value = { "classpath:mongodb.remote.properties" })
public class MyPropertySourcesPlaceholderConfigurer {
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
}
---------------------------------------------------------------------------------
Your property file
label.test.val=this is the property file value!!!!!
---------------------------------------------------------------------------------
@Controller
public class LabelsAndValuesController {
@Value("${label.test.val}")
String test;
}
---------------------------------------------------------------------------------
this is the property file value!!!!!
---------------------------------------------------------------------------------