Failed to start bean ‘documentationPluginsBootstrapper‘; nested exception is NullPointerException

An error is reported in the SpringBoot project:

1)Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException

2)at com.hucj.timetrip.TimeTripApplication.main(TimeTripApplication.java:12) [classes/:na]

3)Caused by: java.lang.NullPointerException: null

This problem occurs with the startup class, which cannot be started.

Reason: Some changes brought about by different versions, Swagger2WebMvc problem

solve:

1. Method 1: Add @EnableWebMvc annotation 

like:

@SpringBootApplication
@EnableWebMvc
public class TimeTripApplication {

    public static void main(String[] args) {
        SpringApplication.run(TimeTripApplication.class, args);
    }
}

The above error will appear in springboot2.6 and above;

Disadvantages: When using a newer version of SpringBoot, other plug-ins and java code libraries may not be updated in time to adapt to the version. For example, Knife4j2.0.9 will not be available in higher versions

2. Method 2: Return to the version below 2.6

Modify the dependent version in parent

 <parent>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>2.5.9</version>
     <relativePath/> 
 </parent>

Guess you like

Origin blog.csdn.net/qq_43780761/article/details/126456774