[Fixed] Error processing condition on org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration.loadBalancerClientFact IllegalStateException – Spring-boot

by
Ali Hasan
dependency-management microservices service-discovery spring-boot spring-cloud-aws

Quick Fix: Use Spring Boot version 2.7.x-SNAPSHOT with Spring Cloud 2021.0.x to resolve the IllegalStateException.

The Problem:

When running a discovery server with specific dependencies(spring cloud and spring boot), an error occurs: java.lang.IllegalStateException: Error processing condition on org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration.loadBalancerClientFact

The Solutions:

Solution 1: Use Spring Cloud version 2021.0.x

Explanation:

The error message indicates that it fails to introspect a method or class from the org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration class due to a missing dependency or class definition.

The specific missing class mentioned is org.springframework.beans.factory.aot.BeanRegistrationAotProcessor, which is part of Spring’s Ahead-of-Time (AOT) compilation capabilities, which are only supported in recent versions of Spring Framework and Spring Boot.

By using Spring Cloud version 2021.0.x, which is compatible with Spring Boot 2.7.x-SNAPSHOT, you can avoid this error as it does not rely on the AOT compilation features.

Q&A

What’s the reason behind Error processing condition on org.springframework.cloud.loadbalancer.config.LoadBalancerAutoConfiguration.loadBalancerClientFactory?

Update the spring cloud version to 2021.0.x.

Which properties need to be set in the pom.xml file?

Set maven.compiler.source and maven.compiler.target to 17.

What dependency does this issue depend on?

elasticsearch dependency.