寫了一個AuthController的接口,執行至方法結束,本以爲成功了,但是Spring卻給了一個模板無法渲染的異常提示。
template might not exist or might not be accessible by any of the configured Template Resolvers
但是我工程裏面沒有配置過template,所以應該不是tempalte的問題;
後來在controller把@Controller換成@RestController解決;
查了一個兩者的區別:
配置@RestController的作用相當同時配置了@Controller和@ResponseBody兩個註解
後來我將@RestController換成@Controller和@ResponseBody也是沒有問題的。