如何配置IntelliJ以查找Spring属性源

huangapple 未分类评论52阅读模式
英文:

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 = &quot;my-components-service.books.configurations&quot;)
Map&lt;ComponentType, BooksConfiguration&gt; booksConfiguration() {
  return new HashMap&lt;&gt;();
}
英文:

<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 = &quot;my-components-service.books.configurations&quot;)
Map&lt;ComponentType, BooksConfiguration&gt; booksConfiguration() {
  return new HashMap&lt;&gt;();
}

答案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.
如何配置IntelliJ以查找Spring属性源

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.
如何配置IntelliJ以查找Spring属性源

huangapple
  • 本文由 发表于 2020年4月8日 15:55:57
  • 转载请务必保留本文链接:https://java.coder-hub.com/61095857.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定