Skip to content

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

Description

@snicoll

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 |  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions