我有一个多模块maven项目(monorepo),其中包含一个用于配置的目录(由spring服务器使用),我希望将IntelliJ配置为使用spring配置处理器自动完成属性。

元数据(additional-spring-configuration-metadata.json)是在微服务模块中正确生成的,但我不知道如何配置Intellij使其在目录中使用外部化配置自动完成。这个是可能的吗?

我尝试将普通配置目录变成maven模块,并添加spring。
发布于 2022-01-03 19:29:37
我找不到一条笔直的路,但这能帮到你:
这种方法是使用spring初始化器制作一些虚拟应用程序,并将其放入配置回购( config repo )中。这样,intellij将启用自动完成。您必须添加所有需要自动完成的模块。
发布于 2022-03-28 07:42:35
我发现的“最小侵入性方法”如下:放置具有以下内容的configurationName.iml文件
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="library" scope="PROVIDED" name="Maven: com.my.component:Major.Minor.Patch-SNAPSHOT" level="project" />
...
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.6.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework.boot:spring-boot-actuator-autoconfigure:2.6.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.6.4" level="project" />
...
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>在yml文件的文件夹里。它是IntelliJ项目文件的简化版本,它应该引用项目中随
*spring-configuration-metadata.json可以使用文件搜索来识别它们。
spring-configuration-metadata.json在(非配置但代码)项目中,选择搜索“所有位置”。

使用“在查找工具窗口中打开”(搜索对话框的最右边角)可以方便地将文件路径复制到剪贴板进行编辑和提取。
如果依赖项发生变化,这种方法的缺点是过时的,但是由于SpringConfigurationmetadata.json不经常更新,而且任务也不是关键的,这对我来说是可以接受的。
一个“这些模块已经从Maven结构中删除”弹出弹出,不要选择从项目中删除模块,这将破坏自动建议。
https://stackoverflow.com/questions/66287246
复制相似问题