实测 Spring Boot 4.0.8(Spring Framework 7.0.9)的 MVC API 版本号:@GetMapping(version = "1.2+") 在没有把 1.9 列入 supported 时请求 1.9 返回 400(InvalidApiVersionException);三种异常、default 与 required、header/查询参数/路径段策略逐一测。
实测 Spring Boot 4.0.8 的 @ImportHttpServices:分组配置在 spring.http.serviceclient.<组名> 下;组名写错无任何启动提示、调用时才抛 URI with undefined scheme;没有 starter-restclient 时属性不生效;不写 group 落在 default 组;read-timeout 按组生效。
实测 Spring Framework 7.0.9 的 BeanRegistrar:循环注册多个 Bean、Spec 的 prototype/lazyInit/primary/fallback、按 profile 注册实现;同名冲突报 defined in null;@ConditionalOnMissingBean 没有把它注册的 Bean 当成已存在。
实测 Spring Boot 4.0.8:RestTestClient 的 bindToController、bindToApplicationContext 与 @AutoConfigureRestTestClient;旧依赖下编译报 package org.springframework.boot.resttestclient.autoconfigure does not exist;Boot 3 的 TestRestTemplate 换包名、要加 @AutoConfigureTestRestTemplate 和 starter-restclient。
实测 Spring Boot 4.0.8 的 Undertow:BOM 里没有 spring-boot-starter-undertow 的版本,Maven 报 dependencies.dependency.version is missing;server.undertow.* 属性 25 个变 0 个;换 Jetty 能直接启动;硬塞 3.5.16 的 starter 时仍然跑 Tomcat,去掉 Tomcat 则 MissingWebServerFactoryBeanException。
实测 Spring Boot 4.0.8 的测试切片注解:14 个常用注解里 10 个换了包,@WebMvcTest 到 org.springframework.boot.webmvc.test.autoconfigure;每个注解在独立模块里,要加对应的 test starter;Boot 3 的 import 在四种依赖组合下都编译失败。
实测 Spring Boot 4.0.8:spring-retry 仍由 Boot 管理(2.0.13);Spring Retry 的 maxAttempts = 3 调用 3 次,Framework 7 的 maxRetries = 3 调用 4 次;注解与 @Enable 用错时悄悄不重试;Spring Retry 缺 starter-aspectj 启动失败。
实测 Spring Boot 4.0.8 的 spring-boot-starter-opentelemetry:只加依赖时应用每分钟往 localhost:4318 推 metrics,traces 与 logs 不导出;配了 logs 的地址日志也没出去;三个信号各有开关;收集端不可达时业务不受影响,日志出现 OtlpMeterRegistry 的 WARN。
实测 Spring Boot 的 Port was already in use:Boot 4.0.8 与 3.5.16 报错文字一致(PortInUseException);在本机 macOS 上,一个实例监听 127.0.0.1、另一个监听 0.0.0.0 时两个都能启动;server.port=0 用随机端口。
实测 Spring Boot 4.0.8 的 NoUniqueBeanDefinitionException:两个 Bean 时字段名、@Primary、@Qualifier 如何选择;两个 @Primary 与 @Qualifier 拼错各报什么;List/Map 注入顺序;ObjectProvider.getIfUnique 静默返回 null;构造器参数名在没有 -parameters 时对不上。
实测 Spring Boot 4.0.8 的 Whitelabel Error Page:默认 JSON 只有 timestamp、status、error、path;server.error.* 全部写了不生效也不报错,要改成 spring.web.error.*;include-message、include-stacktrace、whitelabel.enabled 各自的效果;静态 404.html 与自定义 ErrorController。
实测 Spring Boot 4.0.8 的 @ConfigurationProperties 绑定失败:类型转换、枚举、Duration、@Min 与 @NotBlank 校验各报什么;ignoreUnknownFields = false 对配置文件中拼错的 key 报 left unbound,但对 -D 系统属性不起作用;宽松绑定与列表写法。