如何配置intellij以查找spring属性源

Tom*_*kus 5 java spring intellij-idea


我正在寻找一种从注释中跟踪弹簧配置源的方法。
例如,在 Bean 下面是任何方式,例如单击my-components-service.books.configurations并重定向或列出包含将在运行时注入的配置的 yaml 文件?

@Bean
@ConfigurationProperties(prefix = "my-components-service.books.configurations")
Map<ComponentType, BooksConfiguration> booksConfiguration() {
  return new HashMap<>();
}
Run Code Online (Sandbox Code Playgroud)

Par*_*erM 0

如果@ConfigurationProperties是在类级别,那么应该有一些装订线图标来显示属性的设置位置。 IntelliJ Spring Boot 属性装订线弹出窗口

然而,当在您的示例中指定类似内容时,这看起来不起作用@Bean。一种可能的解决方法是使用嵌套@Configuration类,尽管这可能是不可取的。 在此输入图像描述