天天看點

springboot2.2.1下@RestController等注解報錯

2019年11月7日釋出的springboot2.2.1版本,在使用@RestController和@RequestMapping注解時報錯。

springboot2.2.1下@RestController等注解報錯

提示無法引入這兩個注解。

maven依賴也沒問題

<dependency>
	<groupId> org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-web</artifactId>
</dependency>
           

但是,在pom.xml中把springboot版本改為2.2.0後居然不報錯了。

<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
           
springboot2.2.1下@RestController等注解報錯

目前還沒找到原因,先标記一下,有時間再研究。

後記:昨天晚上其他包也出現了這個問題,我試圖打開class檔案後eclipse報錯,提示invalid LOC header (bad signature) ,我猜測可能是maven下載下傳的jar包有問題,就把所有2.2.1版本下載下傳的jar包删除後重新下載下傳,問題解決。

繼續閱讀