我无法从Spring MVC应用程序中的application.yml文件设置活动配置文件。
我的application.yml是
<ul class="pagination">
<li><a href="http://localhost:8000/productos?page=1" rel="prev">«</a></li>
<li><a href="http://localhost:8000/productos?page=1">1</a></li>
<li class="active"><span>2</span></li>
<li><a href="http://localhost:8000/productos?page=3">3</a></li>
<li><a href="http://localhost:8000/productos?page=3" rel="next">»</a></li>
</ul>
我按如下方式加载Yaml:
spring:
profiles:
active: dev
我的环境活动配置文件始终为空
@Bean
public static PropertySourcesPlaceholderConfigurer properties() {
PropertySourcesPlaceholderConfigurer
propertySourcesPlaceholderConfigurer = new
PropertySourcesPlaceholderConfigurer();
YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ClassPathResource("application.yml"));
propertySourcesPlaceholderConfigurer.setProperties(yaml.getObject());
return propertySourcesPlaceholderConfigurer;
}
请帮助