swagger2:2.9.2後臺NumberFormatException

swagger2:2.9.2後臺NumberFormatException的解決辦法

1、使用swagger2查看api文檔的時候,每次打開在後臺總是出現一堆錯誤信息。很不美觀,也給程序調試帶來麻煩
WARN i.s.m.parameters.AbstractSerializableParameter -[AbstractSerializableParameter.java:421]- Illegal DefaultValue null for parameter type integer
java.lang.NumberFormatException: For input string: “”

2、通過網絡查詢原因出現在swagger-model上面,swagger2:2.9.2默認依賴的的swagger-model版本是1.5.20,這個版本有類型轉換bug。我們只需要手動把swagger-model版本替換爲1.5.22版本即可

3、整體依賴如下

<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger2</artifactId>
	<version>2.9.2</version>
	<exclusions>
		<exclusion>
			<groupId>io.swagger</groupId>
			<artifactId>swagger-models</artifactId>
		</exclusion>
	</exclusions>
</dependency>
<dependency>
	<groupId>io.swagger</groupId>
	<artifactId>swagger-models</artifactId>
	<version>1.5.21</version>
</dependency>
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-bean-validators</artifactId>
	<version>2.9.2</version>
</dependency>
<dependency>
	<groupId>io.springfox</groupId>
	<artifactId>springfox-swagger-ui</artifactId>
	<version>2.9.2</version>
</dependency>

小尾巴~~
只要有積累,就會有進步

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章