简体   繁体   English

IntelliJ IDEA Ultimate Edition 将我的所有 Spring 引导属性标记为未使用

[英]IntelliJ IDEA Ultimate Edition marks all my Spring Boot properties as unused

IntelliJ IDEA Ultimate Edition marks all my Spring Boot properties as unused. IntelliJ IDEA Ultimate Edition 将我的所有Spring 引导属性标记为未使用。

  1. I am aware of Unused properties in IntelliJ , but it does not help.我知道IntelliJ 中的 Unused 属性,但它没有帮助。 The problem in that question was that the OP had Community Edition.该问题的问题是OP有社区版。

  2. The problem is not that the folder would be not marked as Resources (see the screenshot).问题在于该文件夹不会被标记为资源(参见屏幕截图)。

  3. The problem is not that Idea would not recognize the file as the properties file (see the screenshot).问题在于 Idea 不会将该文件识别为属性文件(参见屏幕截图)。

  4. Idea can even show correct tooltips for the properties (see the screenshot). Idea 甚至可以为属性显示正确的工具提示(参见屏幕截图)。

  5. All the properties are used, if I remove any of them, my application stops working:)所有属性都已使用,如果我删除其中任何一个,我的应用程序将停止工作:)

  6. For the record: I do not want to suppress the warnings.备案:我不想压制警告。

  7. Yes, I invalidated the cache.是的,我使缓存无效。

  8. Yes, I did reimport the project to Idea, yes, I did run mvn idea:idea .是的,我确实将项目重新导入到 Idea,是的,我确实运行了mvn idea:idea

在此处输入图像描述

在此处输入图像描述

Versions版本

IntelliJ IDEA 2021.3.3 (Ultimate Edition)
Build #IU-213.7172.25, built on March 15, 2022
Runtime version: 11.0.14.1+1-b1751.46 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
Non-Bundled Plugins:
    com.intellij.ideolog (203.0.27.0)
    String Manipulation (9.4.0)
    dev.eltonsandre.intellij.spring.assistant.plugin (1.3.4)
    com.intellij.lang.jsgraphql (3.1.2)
    com.intellij.bigdatatools (213.5449.349)
    com.haulmont.jpab (2022.1.2-213)
Kotlin: 213-1.5.10-release-949-IJ7172.25

Have you installed Spring Initializr and Assistant plugin?您是否安装了 Spring Initializr 和 Assistant 插件? I had this problem after install it.安装后我遇到了这个问题。 You can try to disable it.您可以尝试禁用它。

Have you tried invalidate cache?您是否尝试过使缓存无效? Maybe that could help you make it run.也许这可以帮助你让它运行。 There are multiple options in invalidate cache, choose according to your use case.无效缓存有多个选项,根据您的用例选择。

File > Invalidate Cache文件 > 使缓存无效

It is confirmed that the Spring Initializr and Assistant plugin was the culprit:已确认Spring Initializr 和 Assistant插件是罪魁祸首:

Credits : Thanks to @DiegoMN's tip.致谢:感谢@DiegoMN 的提示。

According to the author, it should be fixed now, however now no properties are marked as unused.根据作者的说法,它现在应该被修复,但是现在没有属性被标记为未使用。 It is under investigation.它正在调查中。

Elton André commented on 01 Apr 2022:埃尔顿安德烈在 2022 年 4 月 1 日评论道:

For now, the functionality that scans and verifies the usage of Spring properties is not fully implemented.目前,扫描和验证 Spring 属性使用情况的功能尚未完全实现。 For now, in this release, it will suppress all Spring settings (application*.properties and bootstrap*.properties files), to give a little more comfort to the eyes, and that there aren't too many unused warnings.目前,在此版本中,它将抑制所有 Spring 设置(application*.properties 和 bootstrap*.properties 文件),以使眼睛更加舒适,并且没有太多未使用的警告。 As soon as possible, I will be happy to make the full version available with the appropriate alerts for unused and deprecated properties.我很乐意尽快提供完整版本,并针对未使用和已弃用的属性提供适当的警报。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM