有没有办法获取所有配置属性的名称在Spring启动? [英] Is there a way to get the names of all configuration properties in Spring boot?

查看:281
本文介绍了有没有办法获取所有配置属性的名称在Spring启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Spring真的很新。我使用弹簧引导提供的外部配置功能。它工作良好,我使用它在几个配置类,通常只有默认值。现在我想了解我使用的配置属性。
这意味着我需要知道所有属性设置与 @Value(...)或或与 @ConfigurationProperties(prefix = .. 。)。有没有办法从Spring获取这些信息?

I am really new to Spring. I use the external configuration feature provided by spring boot. It works well and I used it in several configuration classes, often only with default values. Now I want to get an overview over the configuration properties I used. That means I need to know all properties set with @Value(...) or or with @ConfigurationProperties(prefix = ...). Is there a way to get this information from Spring? I can do this with reflections but I think this is not the best way.

推荐答案

如果您使用 STS ,然后有一个特殊的编辑器的application.properties文件与自动完成功能。如果您使用Eclipse,则必须转到要配置的类,并检查代码中的@Value注释。

If you are using STS then there is a special editor for the application.properties file with a auto complete feature. If you are using Eclipse, you must go to the class that you want to configure and check the @Value annotations in the code.

这篇关于有没有办法获取所有配置属性的名称在Spring启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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