Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

springboot版本
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
knife4j
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>3.0.2</version>
</dependency>
出现空指针的地方 给HttpServletResponse response设置注解就会出现空指针 注释掉就正常

不知道为什么 百度不到答案
在使用Spring Boot 2.7.1版本和Knife4j 3.0.2版本进行整合时,博主遇到一个异常:在dispatcherServlet处理请求时抛出NullPointerException。问题出现在为HttpServletResponse设置注解时,注解会导致该异常,而取消注解则能正常运行。目前尚未在搜索引擎中找到解决方案。
868

被折叠的 条评论
为什么被折叠?



