首页 > 解决方案 > Spring ResourceBundleMessageSource 多个属性文件配置在 spring xml 文件中?

问题描述

例如,我有两个属性文件,如消息和查询。如何在spring xml中配置

标签: spring

解决方案


Well, you could use the below code snippet.

    <context:property-placeholder
    location="classpath:dao.properties,
    classpath:services.properties,
    classpath:user.properties"
    ignore-unresolvable="true"/>
  1. In this, the order attribute needs to be specified to fix the order in which these are processed by Spring.
  2. All property placeholders minus the last one (highest order) should have ignore-unresolvable="true" to allow the resolution mechanism to pass to others in the context without throwing an exception

推荐阅读