未为文件 Intellij IDEA 配置文件集
当我在 Intellij IDEA 上的应用程序中打开 Spring 配置文件时,有时它会显示
File Set Not Configured For The File
并给我一个链接
Configure File Set
,当我单击它时,它会显示:
MVC dispatcher servlet
Create New File Set
或打开一个新窗口 cnd 让我检查一些文件。
当我点击它们时会发生什么?这是做什么用的?我单击 MVC 调度程序 Servlet 并检查代码,但没有看到任何更改。
它是做什么用的?
When I open a Spring configuration files at my application on Intellij IDEA sometimes it says
File Set Not Configured For The File
and gives me a link
Configure File Set
When I click it it says:
MVC dispatcher servlet
Create New File Set
or opens a new window cnd let me check some files.
What happens when I click them and what is this for? I click MVC dispatcher Servlet and check the code but doesn't see any changes.
What it is for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是 IDEA 帮助您解决不同文件之间的依赖关系的问题。
例如,您有“service-spring-config.xml”和“mvc-spring-config.xml”,其中 MVC 配置使用服务配置中的一些 bean。如果将这两个文件添加到“文件集”中,IDEA 将知道这两个文件代表单个应用程序上下文。
了解这一点后,它将帮助您在 XML 中自动完成 bean,如果某些问题无法解决,它将通知您,而无需您实际运行应用程序。
这是因为您只有一个文件(目前)。稍后,您可以添加一些其他配置,这些配置相互使用/引用 bean =>那么它将变得非常有用
来自 IDEA 文件集 文档:
通过将 Spring XML 配置文件合并到一个文件集中,您可以告诉 IntelliJ IDEA 这些文件是相互关联的。通过这种方式,您可以为这些配置文件形成一个通用的编辑上下文,并获得所有相关的编码帮助。
this is for IDEA to help you out with dependencies between different files.
For example you have "service-spring-config.xml" and "mvc-spring-config.xml", where the MVC config uses some beans from the Service config. If you add these both files to the "File Set", IDEA will know that these two files represent a single application context.
By knowing that, it will help you autocomplete beans in XML + will inform you if something is not resolvable without you having to actually run the app.
This is because you only have a single file (for now). Later on, you can add some other configs that use/reference beans from each other => then it'll become REALLY helpful
From IDEA File Sets documentation:
By combining Spring XML configuration files in a file set you tell IntelliJ IDEA that these files are mutually related. In this way you form a common editing context for these configuration files and get all the associated coding assistance.
IntelliJ 上的 Spring 文件集用于对相关文件进行分组。
IntelliJ 可以自动检测其中一些组,例如在 web.xml 上使用 ContextLoaderListener 加载的文件或 DispatcherServlet 的默认文件(这似乎是您的情况)
当 IntelliJ 要求为 Spring 文件配置文件集时,是因为 IntelliJ无法检测到包含在组中的默认方式,例如在 ApplicationContext 的构造函数中加载的文件 例如:
当正确配置文件集时,IntelliJ 可以带来许多好处,例如自动完成,导航、验证、依赖图等
Spring file sets on IntelliJ are for grouping related files.
IntelliJ could autodetect some of this groups, for example files that are loaded with ContextLoaderListener on web.xml or default files for DispatcherServlet (That seems to be your case)
When IntelliJ asks to configure a File Set for a Spring file, is 'cause IntelliJ couldn't detect a default way to include in a group, for example files that are loaded within the ApplicationContext's constructor Ex:
When file sets are correctly configured IntelliJ could bring many goodies like auto-complete, navigation, validation, dependency graphs and others