1. 默认的我们通常只在dao层用到jdbc的配置,然后使用到@Value注解获取到值。

 这时候会在spring-dao扫描中加入下面配置

    <context:property-placeholder location="classpath:jdbc.properties"  ignore-unresolvable="true"/>
    <context:property-placeholder location="classpath:config.properties"  ignore-unresolvable="true" />

2. 如果想在controller中使用@Value指定变量,则还需要在springmvc中加入同样的配置。

  <context:property-placeholder location="classpath:config.properties"  ignore-unresolvable="true" />

 

相关文章:

  • 2021-06-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
  • 2021-05-12
  • 2022-03-04
  • 2022-02-09
猜你喜欢
  • 2021-06-02
  • 2021-11-10
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案