首页 > 解决方案 > 配置多个消息属性

问题描述

我有属性文件,我需要将它们都设置为加载,但我不知道如何使用多个属性执行此操作

resources
`-- messages.properties
`-- handle.properties

标签: javaspring

解决方案


使用@PropertySources. 注释保存文件属性的配置类或您的Main类。

例如:

@PropertySources(
        {
        @PropertySource("classpath:messages.properties"),
        @PropertySource("classpath:handle.properties")
        }
)

推荐阅读