1、properties文件的引入

<bean  
         class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
         <property name="locations" value="mail.properties"/>
    </bean>
    <bean >
       <property name="host" value="${mail.host}"/>
       <property name="username" value="${mail.user}"/>
       <property name="password" value="${mail.pwd}"/>
    </bean>

或者
<bean name="propertyConfigurer"  
   class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">  
   <property name="locations">  
      <list>  
         <value>classpath:mail.properties</value>
      </list>  
   </property>  
</bean>

2、

相关文章:

  • 2021-10-27
  • 2022-12-23
  • 2021-11-19
  • 2021-11-29
  • 2022-12-23
  • 2021-09-28
  • 2022-01-05
  • 2021-07-28
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2021-04-25
  • 2022-02-21
  • 2021-11-27
  • 2021-07-16
  • 2022-01-02
相关资源
相似解决方案