Spring Boot Error: java.lang.NoClassDefFoundError: org/springframework/util/Assert
It is better to follow software principles while you are learning and making projects. Try to make project in a way that separation of concern is always achieved, that will make your code not just easy to understand, but to debug and fix too.
Change your application class like this:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Now make another package controller and make class in it for your testing
@RestController
//You can add this if you want or remove this class level mapping
@RequestMapping("/testApp")
public class TestController {
@RequestMapping("/")
public String home() {
return "Hello World";
}
}
For further help. please check this (official spring.io tutorial) simple example of Spring Boot App in STS.
And another one is this very simple and straightforward to get Spring Boot App up and running.
Edit: please add starter test in pom.xml as well.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.10.RELEASE</version>
<scope>test</scope>
</dependency>
How to fix the error 'java.lang.NoClassDefFoundError: org/springframework/boot/bind/RelaxedPropertyResolver' in a spring-boot application?
This is because of using the spring-boot-starter-parent
version as 2.x but trying to use the older versision 1.5.x for a related dependency, say spring-boot-autoconfigure
.
The code below will cause this error because the dependency version is not matching from that of the parent.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath />
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>1.5.13.RELEASE</version>
</dependency>
</dependencies>
Related Topics
Spring Security Configuration Filter Any Requests Except a Specific Endpoint
Converting Date to 08:00:00.000+0000
Spring-Boot @Autowired Interface (Crudrepository) in My Service Class => Null Pointer Exception
How to Solve Maven 2.6 Resource Plugin Dependency
Spring JPA - Why Is My Findall Returning Null When There Is Data in My Database
How to Map an Auto Increment Field in Hibernate
How to Fetch All Links and Click Those Links One by One Using Selenium Webdriver
Intellij Compilation Error Zip End Header Not Found
Value Annotation Not Working in Junit Test
Map Yaml to Object Hashmap in Springboot
Check If Two Objects Are Equal Excluding a Few Properties
When I Run Mockito Test Occurs Wrongtypeofreturnvalue Exception
Java Error - Illegal Modifier for Parameter - Only Final Permitted
Password Encrypt and Decrypt Using Spring-Security
How to Sort Json Object in Java
Regular Expression to Validate Username
How to Return Different Results When Calling the Same Mocked Method