I am very new to spring mvc 3 annotation based application. I have two properties files - WEB-INF\\resources\\general.properties, WEB-INF\\resources\\jdbc_config.properties
I ended up using Environment
Add these lines to config
@PropertySource("classpath:/configs/env.properties")
public class WebConfig extends WebMvcConfigurerAdapter{...}
You can get the properties from controller using autowired Environment
public class BaseController {
protected final Logger LOG = LoggerFactory.getLogger(this.getClass());
@Autowired
public Environment env;
@RequestMapping("/")
public String rootPage(ModelAndView modelAndView, HttpServletRequest request, HttpServletResponse response) {
LOG.debug(env.getProperty("download.path"));
return "main";
}
}