bean creation error when starting spring boot application

We Are Going To Discuss About bean creation error when starting spring boot application. So lets Start this Java Article.

bean creation error when starting spring boot application

  1. bean creation error when starting spring boot application

    To elaborate on @M-deinum's comment, setting Spring Boot version to 2.3.4.RELEASE (instead of 2.4.2 in my case) solved the issue. In gradle this meant changing:
    plugins { id 'org.springframework.boot' version '2.4.2' ... }
    To
    plugins { id 'org.springframework.boot' version '2.3.4.RELEASE' ... }

  2. bean creation error when starting spring boot application

    To elaborate on @M-deinum's comment, setting Spring Boot version to 2.3.4.RELEASE (instead of 2.4.2 in my case) solved the issue. In gradle this meant changing:
    plugins { id 'org.springframework.boot' version '2.4.2' ... }
    To
    plugins { id 'org.springframework.boot' version '2.3.4.RELEASE' ... }

Solution 1

To elaborate on @M-deinum’s comment, setting Spring Boot version to 2.3.4.RELEASE (instead of 2.4.2 in my case) solved the issue. In gradle this meant changing:

plugins {
    id 'org.springframework.boot' version '2.4.2'
    ...
}

To

plugins {
    id 'org.springframework.boot' version '2.3.4.RELEASE'
    ...
}

Original Author Of This Content

Solution 2

I had a same issue, and it is happening because of Spring Cloud services and Spring Boot version issues. I got rid of it by using https://start.spring.io/ to generate my project.

When you select all dependencies needed for your project, you can then click the Explore button and check the pom.xml file.

This issue happened to me when I tried to add dependency for Eureka-client to my pom.xml after generating project, so using IntelliJ.

I got the same error.

Then I went to Spring.io again select dependencies that I use for my project and also dependency for Eureka-client, clicked on Explore button and saw that I need to add this line of code under java version in pom.xml

<spring-cloud.version>2020.0.3</spring-cloud.version>

But also this lines as well:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

So I just copy pasted it to my existing pom.xml and it worked!

Original Author Of This Content

Solution 3

You need to change spring boot version to Released version

from

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.0</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

to

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.3.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

Original Author Of This Content

Solution 4

Spring-Cloud – Hoxton.SR8 is not compatiable with Spring-boot 2.4.0

Just use either of the combinations:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.0</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<spring-cloud.version>2020.0.3</spring-cloud.version>

Or

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.0</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<spring-cloud.version>Hoxton.SR8</spring-cloud.version>

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment