How to solve java.lang.NoClassDefFoundError: org/springframework/beans/factory/SmartInitializingSingleton in Spring Boot [Solved]

Problem:
I was trying to run a HelloWorld program using Spring Boot when I got this error:

Exception in thread "main" java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer due to internal class not found. This can happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:52)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:92)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:174)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:136)

Top 6 Udemy Courses to Learn Microservices with Java and Spring Boot in 2025 - Best of Lot

Hello guys, if you want to learn about Microservices architecture and how to create Microservices with Java using Spring Boot and Spring cloud framework and looking for the best online courses then you have come to the right place. Earlier, I have shared the best free Microservices courses for Java programmers and in this article, I am going to share the best online courses to learn Microservices with Java in 2025. Popularity of Cloud Computing has given an exponential rise to Microservices architecture because they go hand in hand. 

Top 5 Free Udemy Courses to Learn Microservices for Java Developers in 2025 - Best of Lot

Hello Java programmers, if you want to learn Microservice architecture and look for free Microservice resources like free online courses, you have come to the right place. Earlier, I have shared the best Microservice courses for Java programmers to build Microservice using Java and the Spring framework, and today, I will share some free courses to learn Microservice in Java using Spring Boot and the Spring Cloud framework. If you don't know, Microservices is a modern architecture that goes along nicely with cloud computing and makes deployment, scaling, and even development easier. 

Top 10 Free Udemy Courses to become Fullstack Java Developer in 2025 - Best of Lot

Hello guys, if you want to become a full-stack Java developer and are looking for free online Java Full-stack development courses to kickstart your career, you have come to the right place. Earlier, I have shared the best Java full-stack development courses, and today, I will share 10 of the free online courses you can join to become a full-stack Java developer. The long journey of becoming a full-stack Java developer is not easy. You need to know all the details, from the front end to the backend. Not only these, but you also need to know how things function in databases and connectivity.

Top 10 Projects You can Build to Learn Spring Boot in 2025

Hello guys, I have always said that there is no better way to learn anything then actually doing it and its 100% true for Spring Boot, one of the popular Framework for Java application Development. In my 20 years of experience, I have found that the best way to learn Java and Spring Boot is building projects. When you build project, common task surface them like creating a List or sorting a List and then you research and learn. Those learning stuck and make you better developer. Building project also have many advantage like it allows you to use a lot of technologies like Git, IntelliJIDEA, Hibernate, APIs etc together to build something which you can showcase to your potential employer. 

Top 7 Spring Boot Online Courses for Beginners in 2025 - Best of Lot [UPDATED]

Hello guys, if one of your goals is to learn Spring Boot in 2025, and I have started working towards it. As I have talked about my 3 point action plan to learn new technology, the first step is to attend some online courses and start building from that. If you are not sure what is Spring Boot and why should you learn Spring Boot, then let me tell you that it should be the first Java framework you should learn in 2025. The Spring Boot makes it really easy to work with the Spring framework by removing all the starting hurdles concerning setup and configuration. In one word, it makes it possible to write a Spring-based Java application and run them like core Java applications, like from the primary method.

Difference between @GetMapping @PostMapping @PutMapping @DeleteMapping @PatchMapping

In the world of web development, the Spring Framework is widely known for its versatility and ease of use. It provides several annotations that simplify the process of handling HTTP requests and mapping them to specific methods in Spring controllers. Among these annotations, @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, and @PatchMapping are some of the most commonly used ones. In this article, we will explore each of these annotations in detail, highlighting their purposes, differences, and providing examples to better understand their usage.

How to Build Event-Driven Microservices with Spring Boot and Kafka? Example Tutorial

Event-driven microservices have gained immense popularity in modern software development due to their scalability, flexibility, and robustness. Leveraging technologies like Spring Boot and Kafka, developers can build highly responsive and loosely coupled systems. In this article, we will explore the fundamentals of event-driven microservices, using Spring Boot and Kafka, and finally, create a Java program that demonstrates the integration of these technologies using a real-world example.But, before we dive into the code. It’s very important to have a thorough understanding of the key terms. Let go through it one by one.

Top 20 Microservices Interview Questions with Answers for Java Developers

Hello guys,  if you are preparing for Java interviews then preparing for Microservice architecture is a good decision but there are not many places where you can find Microservice interview questions, so I thought to share some common Microservices questions from Java interviews. If you are a regular reader then you may know that I have been sharing spring interview questions regularly like I shared spring boot questions last year and this year, I have shared spring cloud questions and spring data jpa questions so far. You can use those articles to prepare well for any Java and Spring boot interviews, but I also suggest spending some time learning core spring concepts as those are very important.

13 Spring Boot Actuator Interview Questions Answers for 5 Years Experienced

If you have used Spring Boot, you may know that Spring Boot is all about convenience, and the Spring Boot actuator is one of such features that provides a convenient way to interact with your app using HTTP and JMX. It's also essential from the Spring Boot interview point of view. While I did include some Spring Boot Actuator questions in my earlier post about frequently sked Spring boot interview questions, many of you asked for more questions to cover Spring Boot Actuator in depth, so I decided to write a separate article. In this article, we will see some popular Spring boot Actuator interview questions and, along the way, learn more about this helpful Spring boot Feature

Difference between Spring vs SpringBoot Framework in Java

Hello guys, if you have been doing Java development then you would have definitely come across both Spring and Spring Boot framework These two Java frameworks have taken the software development world by storm and have become the go-to tools for building all kinds of applications. But what exactly are Spring and Spring Boot, and how do they differ from one another? This is one of the common questions which many Java programmer ask, particularly those who are starting with software development or new to Java world. In the past, I have shared several Spring and Spring boot articles, courses, books, projects, and interview questions but in this article, I am going to answer what exactly is Spring and Spring Boot and what is the difference between them? This will also help you to decide  when to use Spring Framework or Spring Boot for Java application development. 

How to access configuration values from application.properties file in Spring Boot? Example Tutorial

Hello guys, if you are wondering how to access a value defined in your spring application configuration file then you are not alone, many Java developer face the same challenge. How to access a value defined in the application.properties file in Spring Boot is a common question that arises when you dealing with large software applications. In software applications, you need to have different environments for the QA, production, and local. So as a solution for this, you can use different configurations and update the files separately without affecting other environments by using property files.

How to Accept and Produce JSON as a response in Spring Boot? Example Tutorial

Hello everyone, welcome to the blog post. In this short tutorial, we are going to take an in-depth look at how to consume and produce JSON responses using a widely appreciated Java framework i.e. Spring Boot. As we all know Spring Boot is a framework designed to build a secure web application, microservice, REST API, and production-ready spring application. Modern-day application deals in a large amount of data, which they share in JSON format. A JSON is a standard plain text-based representation of structured data. It is one of the popular formats for data transmission over the internet. Due to its user-friendly syntax and lightweight, it helps in the process faster. 

How to configure multiple data sources in Spring Boot? Example Tutorial

Spring Boot is a popular framework for building Java applications that simplifies the development process. In some scenarios, you may need to work with multiple databases or data sources in your Spring Boot application. Earlier, we have seen how to change port of spring boot application and in this article will guide you through the process of configuring and using two data sources in Spring Boot. We will explore various approaches and provide practical examples to help you effectively manage multiple data sources in your application.

How to Configure CORS in a Spring Boot + Spring Security application

Cross-Origin Resource Sharing (CORS) is an essential mechanism for controlling access to web resources across different domains. When developing a Spring Boot application with Spring Security, it is crucial to configure CORS properly to allow or restrict cross-origin requests based on security requirements. In this article, we will explore how to configure CORS in a Spring Boot + Spring Security application, ensuring secure and controlled access to resources. We will provide step-by-step instructions and relevant code examples to help you implement CORS effectively.

Difference between application.properties vs Application.json vs Application.yml in Spring Boot

Hello guys, if you have worked in any Spring Boot application then you may have noticed that there are multiple ways to declare configuration for Spring Boot application. I am sure you must have noticed application.propties, application.json, and application.yml while working in proprietary or open source Spring Boot application. When I first started, it was application.propties and it was quite familiar because I have used properties file in past for specify configuration of Java application but when I first see applcation.json and application.yml I was bit confused like what they are and does they really work? In the end I found out that they are just different ways to specify configuration for any Spring Boot application. 

Difference between Spring Boot vs Spring Cloud in Java

Hello guys, if you are wondering, what is difference between Spring Boot and Spring Cloud then you re not alone. Many Java developer are not familiar with various spring boot projects like Spring Security, Spring Data JPA, Spring Batch, Spring Boot, Spring Cloud etc and this lack of knowledge prevent them from taking full advantage of Spring Framework.  In last article, I have explained difference between Spring framework and Spring Boot and in this article we are going to discuss the difference between Spring Boot and Spring Cloud. Before we dive into the difference between the two terms. Let us take a look at different terms like Spring, Spring Boot, and Spring Cloud.

How to Handle REST exception in Spring Boot Application? Example Tutorial

Hello everyone, in this article we are going to take a look at how to handle REST API exceptions in Spring Boot. It is crucial to handle errors correctly in APIs by displaying meaningful messages as it helps API clients to address problems easily. What happens if we don’t handle the errors manually? By default, the spring application throws a stack trace, which is difficult to understand. Stack traces are mainly for developers hence it is useless for API clients. That's why its very important to use proper HTTP code and error messages to convey errors and exception to client and also logging so that support team can better handle them. Ideally you should tell what went wrong and how to fix it? For example, if the error is due to duplicate data then clearly say, already existed, try with a new one. Similarly, if authentication fail then clearly say authentication failed instead of throwing some other exception. 

How to set base URL for REST in Spring Boot? Example Tutorial

Hello guys, if you are wondering how to set base URL for REST API in Spring Boot then you have come to the right place. Earlier, I have shared best REST API Courses for Java developers, REST API Books,  and a complete guide to create RESTful Web service using Spring Boot, in this article, I will show you how to set a base URL in any spring boot application? If you don't know what is a base URL in a REST application or website, let me give you a brief overview first.  A base URL is the continuous element of your REST API or website's address. For example, you'll notice that the address portion http://twitter.com displays in the address bar whenever you log on to your Twitter account or visit a Twitter profile from your computer. This is the primary or base URL.

How to Enable Disable Spring Security in Spring Boot? Example Tutorial

Hello guys, if you are wondering how to enable and disable Spring Security in a Spring Boot based Java application then you have come to the right place. In the past, I have shared best Spring security courses25 Spring Security questions, as well multiple Spring security tutorials like how to use HTTP Basic auth in Spring Security etc.  and in this article, I will share multiple ways to enable and disable Spring Security in a Spring boot application. But, before that, if you are new to Spring Security then find out what is Spring Security and how does it work?  At its core, Spring Security is simply a bunch of servlet filters that assist you with adding authentication and authorization to your web application.