Springboot 项目中 xml文件读取yml 配置文件

  1. <bean id="yamlProperties" class="org.springframework.beans.factory.config.YamlPropertiesFactoryBean">
  2.  
    <property name="resources" value="classpath:config/application-release.yml"/>
  3.  
    </bean>
  4.  
     
  5.  
    <context:property-placeholder properties-ref="yamlProperties"/>
  6.  
     
  7.  
    <property name="driverClassName" value="${spring.datasource.driverClassName}"/>
  8.  
    <property name="url" value="${spring.datasource.url}"/>
  9.  
    <property name="username" value="${spring.datasource.username}"/>
  10.  
    <property name="password" value="${spring.datasource.password}"/>
原文地址:https://www.cnblogs.com/lykbk/p/sdfsdfsdfs435456454.html