Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot IntelliJ支持重命名的application.properties_Spring Boot_Intellij Idea - Fatal编程技术网

Spring boot IntelliJ支持重命名的application.properties

Spring boot IntelliJ支持重命名的application.properties,spring-boot,intellij-idea,Spring Boot,Intellij Idea,我有一个多模块Spring Boot应用程序,其中有多个模块包含applications.properties文件。我知道我只能有一个名为application.properties的文件,因此我重命名了其中一个文件,然后通过@PropertySource(“classpath:custom name.properties”)显式地将其包括在内。这很好,但这样做会使我失去对该文件的IntelliJ属性文件支持(自动完成、跳转到源代码等)。文件的图标也会更改,不再有弹簧符号。如何将IntelliJ

我有一个多模块Spring Boot应用程序,其中有多个模块包含
applications.properties
文件。我知道我只能有一个名为
application.properties
的文件,因此我重命名了其中一个文件,然后通过
@PropertySource(“classpath:custom name.properties”)
显式地将其包括在内。这很好,但这样做会使我失去对该文件的IntelliJ属性文件支持(自动完成、跳转到源代码等)。文件的图标也会更改,不再有弹簧符号。如何将IntelliJ支持重命名为
应用程序。属性?

您可以通过在相应模块中打开Spring facet来定义Spring引导配置文件的自定义名称,选择Spring引导自动检测文件集,然后单击工具栏中的“自定义Spring引导”图标。然后将textfield“spring.config.name”设置为“custom name”,所有匹配的配置文件将显示在下面的树中。

实际上,我在该模块的facet中没有任何自动检测到的配置。我可以在这个模块中手动添加
@Configuration
类和
自定义name.properties
作为附加属性源(这并不能使它像我想要的那样工作),但是我没有自定义选项,因为我的模块在facet中有一个自动检测条目。因此,我可以通过将此模块中的
@Configuration
类替换为
@springbootplication
来让它在项目facet中自动检测此模块配置,但我担心这可能是意外的后果。这个模块并不意味着它是自己的应用程序,只被其他模块用作依赖项。在这样的模块上有这样的注释有意义吗?似乎您的用例在本期中有所涉及