ITeye博客

spring PreferencesPlaceholderConfigurer对properties文件读取值

艾伦蓝 · 2017-12-01 16:55 · spring · sprint boot · 编程语言 · Markdown

[color=red][b]1.创建config.propertites文件 [/b][/color] [code="txt"] key=value [/code] [color=red][b]2.配置文件applicationContext.xml[/b][/color] [code="xml"] classpath:*.properties [/code] [color=red][b]3.java类中引用[/b][/color] [code="java"] // id=setting中找key的值 @Value("${key}") private String key; [/code]

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。