org.springframework.boot.env.EnvironmentPostProcessor is still used

未关闭
#116 2 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java, spring-boot
领域
backend

调研方向

The failure is raised from org.springframework.cloud.bindings.boot.BindingFlattenedEnvironmentPostProcessor, which the stack trace shows being instantiated through SpringFactoriesLoader as an ApplicationListener. Start by finding where this class and its factory registration live in the repository, and check how it references the deprecated org.springframework.boot.env.EnvironmentPostProcessor. Done means the class loads and the binding tests pass against Spring Boot 4.2.0-M1, which is the version the reporter says is failing.

由索引模型根据 Issue 内容生成。

描述

org.springframework.boot.env.EnvironmentPostProcessor is deprecated as of Spring Boot 4.0 but Spring Cloud bindings still use it. We're working on Spring Boot 4.2.0-M1 where this is scheduled for removal and our tests are now failing:


Calculating JVM memory based on 11610600K available memory |  
-- | --
For more information on this calculation, see https://paketo.io/docs/reference/java-reference/#memory-calculator |  
Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx11227395K -XX:MaxMetaspaceSize=76004K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 11610600K, Thread Count: 50, Loaded Class Count: 11005, Headroom: 0%) |  
Enabling Java Native Memory Tracking |  
Adding 121 container CA certificates to JVM truststore |  
Spring Cloud Bindings Enabled |  
Picked up JAVA_TOOL_OPTIONS: -Djava.security.properties=/layers/paketo-buildpacks_bellsoft-liberica/java-security-properties/java-security.properties -XX:+ExitOnOutOfMemoryError -XX:MaxDirectMemorySize=10M -Xmx11227395K -XX:MaxMetaspaceSize=76004K -XX:ReservedCodeCacheSize=240M -Xss1M -XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -XX:+PrintNMTStatistics -Dorg.springframework.cloud.bindings.boot.enable=true |  
Exception in thread "main" java.lang.reflect.InvocationTargetException |  
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) |  
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) |  
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) |  
at java.base/java.lang.reflect.Method.invoke(Unknown Source) |  
at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:106) |  
at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:64) |  
at org.springframework.boot.loader.launch.WarLauncher.main(WarLauncher.java:53) |  
Caused by: java.lang.IllegalArgumentException: Unable to instantiate factory class [org.springframework.cloud.bindings.boot.BindingFlattenedEnvironmentPostProcessor] for factory type [org.springframework.context.ApplicationListener] |  
at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$throwing$0(SpringFactoriesLoader.java:632) |  
at org.springframework.core.io.support.SpringFactoriesLoader$FailureHandler.lambda$handleMessage$0(SpringFactoriesLoader.java:656) |  
at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:225) |  
at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:201) |  
at org.springframework.core.io.support.SpringFactoriesLoader.load(SpringFactoriesLoader.java:157) |  
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:472) |  
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:468) |  
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:282) |  
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:260) |  
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1365) |  
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) |  
at example.ExampleApplication.main(ExampleApplication.java:13) |  
... 7 more |  
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/env/EnvironmentPostProcessor |  
at java.base/java.lang.ClassLoader.defineClass1(Native Method) |  
at java.base/java.lang.ClassLoader.defineClass(Unknown Source) |  
at java.base/java.security.SecureClassLoader.defineClass(Unknown Source) |  
at java.base/java.net.URLClassLoader.defineClass(Unknown Source) |  
at java.base/java.net.URLClassLoader$1.run(Unknown Source) |  
at java.base/java.net.URLClassLoader$1.run(Unknown Source) |  
at java.base/java.security.AccessController.doPrivileged(Unknown Source) |  
at java.base/java.net.URLClassLoader.findClass(Unknown Source) |  
at java.base/java.lang.ClassLoader.loadClass(Unknown Source) |  
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:97) |  
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91) |  
at java.base/java.lang.ClassLoader.loadClass(Unknown Source) |  
at java.base/java.lang.Class.forName0(Native Method) |  
at java.base/java.lang.Class.forName(Unknown Source) |  
at org.springframework.util.ClassUtils.forName(ClassUtils.java:308) |  
at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.java:218) |  
... 16 more |  
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.env.EnvironmentPostProcessor |  
at java.base/java.net.URLClassLoader.findClass(Unknown Source) |  
at java.base/java.lang.ClassLoader.loadClass(Unknown Source) |  
at org.springframework.boot.loader.net.protocol.jar.JarUrlClassLoader.loadClass(JarUrlClassLoader.java:97) |  
at org.springframework.boot.loader.launch.LaunchedClassLoader.loadClass(LaunchedClassLoader.java:91) |  
at java.base/java.lang.ClassLoader.loadClass(Unknown Source) |  
... 32 more |  

主要语言
Java
星标
50
派生
33
平均合并
6 天 2 小时
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

spring-cloud/spring-cloud-bindings 的其他 Issue

查看 spring-cloud/spring-cloud-bindings 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。