IDEA 2026.1 升级后Cannot resolve configuration property 'asc.wx.baseUrl',90% 是注解处理器关闭、配置元数据没生成、dev 多环境未关联、Spring 索引异常,按下面步骤一键修复:
一、优先开启注解处理器(2026.1 默认常关闭)
File → Settings → Build, Execution, Deployment → Compiler → Annotation Processors- 勾选Enable annotation processing
- 勾选Obtain processors from project classpath
- 应用保存 → 重启 IDEA
二、pom 必须引入配置元数据依赖(Spring Boot 配置提示核心)
xml
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency>引入后Maven Reload 项目
三、检查 dev 环境配置绑定
application-dev.yml右键 →Mark as Spring Configuration File- 主配置
application.yml确认激活 dev:
yaml
spring: profiles: active: dev- 多模块项目:每个子模块都要加 processor 依赖
四、配置类写法(asc.wxjs 前缀)
java
运行
@Component @ConfigurationProperties(prefix = "asc.wx") public class WxjsConfig { private String baseUrl; // getter/setter }启动类加上扫描(新版必加):
java
运行
@SpringBootApplication @ConfigurationPropertiesScan五、清理 IDEA 缓存 + 重建索引(2026.1 高频索引 bug)
File → Invalidate Caches...
- 勾选所有选项 →Invalidate and Restart重启后执行:
mvn clean compile,生成META-INF/spring-configuration-metadata.json