把@RestController注解删除掉,替换为@Controller注解
@RestController注解表示返回的内容都是HTTP Content不会被模版引擎处理的
它默认为该类中的所有的方法都添加了@ResponseBody
下面是RestController的定义
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Controller
@ResponseBody
public @interface RestController {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
* @since 4.0.1
*/
String value() default "";
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…