1.问题描述
如果A类里面使用了map,且map的value是A类,如图 1-1所示,knife4j在解析json的时候会出现超出最大调用堆栈大小异常(Maximum call stack size exceeded),估计是递归没有边界。
console报错日志
app.ed549958.js:2 RangeError: Maximum call stack size exceeded
at $.get [as currentInstance] (chunk-vendors.9ff0f717.js:2)
at $.findRefDefinition (app.ed549958.js:2)
at $.findRefDefinition (app.ed549958.js:2)
at $.findRefDefinition (app.ed549958.js:2)
at $.findRefDefinition (app.ed549958.js:2)
at $.findRefDefinition (app.ed549958.js:2)
at $.findRefDefinition (app.ed549958.js:2)
at $.findRefDefinition (app.ed549958.js:2)
at $.findRefDefinition (app.ed549958.js:2)
at $.findRefDefinition (app.ed549958.js:2)
2.解决方案
把map字段删了之后就正常了。
3.导致问题的请求和配置数据。
3-1.Knife4j和springfox-swagger版本号:
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.3</version>
</dependency>
3-2.springboot版本号:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starters</artifactId>
<version>2.2.4.RELEASE</version>
</parent>