问题描述
我对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.
推荐答案
如果您使用,然后有一个特殊的编辑器的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启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!