๐Ÿ”ด The Error You're Seeing

Confirm this matches your console output. If it does, you're in the right place.

ERROR LOGorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource [org/springframework/boot/autoconfigure/context/ConfigurationPropertiesAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.context.properties.ConfigurationPropertiesBeans]: Factory method 'configurationPropertiesBeans' threw exception; nested exception is java.lang.IllegalStateException

โšก Quick Fix Works 80% of the time

Check for missing or malformed @ConfigurationProperties classes in your project.

@ConfigurationProperties(prefix = "app") public class AppProperties { ... }

๐Ÿง  Why this Happens

Tap to expand the deep technical explanation

Spring Boot's auto-configuration failed while trying to wire up beans annotated with `@ConfigurationProperties`. This is usually because a property is missing, a constructor is invalid, or a third-party library has a conflicting bean definition.

The HITEC City Parking Spot Analogy:

The factory manager is trying to set up a new machine (ConfigurationPropertiesBeans), but the machine's power cord (a specific property or constructor) is faulty. The manager refuses to open the factory until the machine is fixed.

๐Ÿ” How to Reproduce Confirm this is your error

Create a class with `@ConfigurationProperties(prefix = "app")`. Give it a constructor that requires a parameter that Spring cannot resolve from the properties file. Run the app.

๐Ÿ› ๏ธ Solutions (5 Ways to Fix)

Solution 1โœ“ Most common cause

Add missing properties to application.properties

๐Ÿ‘‰ Use this if your @ConfigurationProperties class expects properties that aren't defined.

If a field in your properties class isn't optional, Spring will fail to bind it if the property is missing.

# application.properties app.name=MyApp app.timeout=5000
Solution 2

Ensure @ConfigurationProperties class has a no-arg constructor

๐Ÿ‘‰ Use this if you added a custom constructor and broke Spring's binding.

Spring uses setter binding by default, which requires a no-arg constructor. If you add a parameterized constructor, you must use @ConstructorBinding.

@ConfigurationProperties(prefix = "app") public class AppProperties { private String name; public AppProperties() {} // Required for setter binding }
Solution 3

Add @EnableConfigurationProperties annotation

๐Ÿ‘‰ Use this if your properties class is in a different module or not component-scanned.

Explicitly tell Spring to register this properties class as a bean.

@SpringBootApplication @EnableConfigurationProperties(AppProperties.class) public class Application { ... }
Solution 4

Fix Spring Boot version mismatches

๐Ÿ‘‰ Use this if you recently upgraded Spring Boot but have old third-party dependencies.

Libraries built for Spring Boot 1.x or 2.x might register ConfigurationPropertiesBeans in a way that conflicts with Spring Boot 3.

<!-- Upgrade old dependencies --> <dependency> <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>2.1.0</version> </dependency>
Solution 5

Exclude problematic auto-configuration

๐Ÿ‘‰ Use this if a specific library's auto-configuration is breaking your context.

If you don't strictly need the library's auto-config, exclude it to bypass the bean creation failure.

@SpringBootApplication(exclude = { ProblematicAutoConfig.class }) public class Application { ... }

๐Ÿ“‹ Version Notes

Spring Boot 2.x

Standard ConfigurationProperties binding.

Spring Boot 3.x

Stricter binding, fails fast on invalid constructor signatures.

๐Ÿ›ก๏ธ How to Prevent This Next Time

Always use `@EnableConfigurationProperties` instead of `@Component` on `@ConfigurationProperties` classes.

Course Search
Search across all chapters & stages
๐Ÿ“–

Search the course

Type any topic โ€” branching, stash, rebase, hooks โ€” and jump straight to that chapter.

merge branchesgit stashundo commitrebase