英文:
How to configure intellij to find spring properties source
问题
Sure, here is the translated content:
<br>
我正在寻找一种从注解中跟踪Spring配置源的方法。<br>
例如,对于以下的Bean,是否有一种方法,例如点击my-components-service.books.configurations
,然后被重定向或列出包含配置的YAML文件,这些配置将在运行时被注入?
@Bean
@ConfigurationProperties(prefix = "my-components-service.books.configurations")
Map<ComponentType, BooksConfiguration> booksConfiguration() {
return new HashMap<>();
}
英文:
<br>
I'm looking for a way to follow source of spring configuration from annotation.<br>
E.g. Having below Bean is any way to e.g. click on my-components-service.books.configurations
and be redirect or list yaml files which contains config which would be injected in runtime?
@Bean
@ConfigurationProperties(prefix = "my-components-service.books.configurations")
Map<ComponentType, BooksConfiguration> booksConfiguration() {
return new HashMap<>();
}
答案1
得分: 0
如果@ConfigurationProperties
位于类级别,则应该会出现一些装饰图标,显示属性的设置位置。
它在像您的示例中指定在@Bean
上时,似乎并不起作用。一个可能的解决方法是使用嵌套的@Configuration
类,尽管这可能是不理想的。
英文:
If @ConfigurationProperties
is at the class level then there should be some gutter icons that will show where the properties have been set.
It doesn't look like this works when it's specified on a @Bean
like in your example however. A possible workaround is to use a nested @Configuration
class, though that may be undesirable.
专注分享java语言的经验与见解,让所有开发者获益!
评论