springboot 中来自用户主页的环境特定属性 [英] Environment specific properties from user home in springboot

查看:26
本文介绍了springboot 中来自用户主页的环境特定属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Spring Boot 应用程序,我必须在其中设置用户主文件夹中的 Environment specific properties.

I am working on a spring boot application in which i have to set Environment specific properties from user home folder.

我为同样的 & 挖谷歌发现我们可以在资源下放置不同的属性文件(开发,测试,生产),然后我们必须使用spring.profiles.active=dev OR prod告诉spring boot我们想要使用哪个环境.

i dig Google for the same & found we can put different properties file (dev, test, production) under resources and then we have to tell spring boot which environment we want to use using spring.profiles.active=dev OR prod.

然而,我的要求完全不同.我将在我的系统中的用户主页中放置一个文件 &想从该文件中读取属性.我该怎么做,需要指导.

however, my requirement is quite different. i will put a file in user home in my system & want to read properties form that file. how can i do that, need guidance.

非常感谢您的帮助.

推荐答案

我们在 Devoxx 演示文稿中使用 EnvironmentPostProcessor 解释了该用例,请参阅 演示文稿的这一部分了解更多详情.你也可以 在线查找代码示例.

We explain that use case in a Devoxx presentation using EnvironmentPostProcessor, please refer to this section of the presentation for more details. You can also find the code sample online.

这篇关于springboot 中来自用户主页的环境特定属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆