springboot请求视图自动添加.vm后缀报错

代码是这样的一个简单的请求后台的请求:

/**
 * 定向去首页
 *
 * @return
 */
@RequestMapping("/test")
public String testPage(HttpServletRequest request, HttpServletResponse response) throws Exception {
    return "/resource/pages/test";
}

后台报错:

 ResourceManager :unable to find resource '/resource/pages/test.vm' in any resource loader

查了下资料,说是velcocity自动配置了,然后把视图后缀自动添加了.vm,但是我没有配置 Velocity:
按照如下更改application.properties

 spring.velocity.enabled=false
  spring.velocity.checkTemplateLocation=false
  spring:
  mvc:
  view:
  prefix:/
  suffix:.html
@SpringBootApplication(exclude {DataSourceAutoConfiguration.class,VelocityAutoConfiguration.class})
 @ServletComponentScan
 public class WebInitializer extends SpringBootServletInitializer {
  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(WebInitializer.class);
  }
}

均没有效果,在springboot中VelocityAutoConfiguration和spring.velocity.enabled=false
spring.velocity.checkTemplateLocation=false 都已经标识为过期类?有什么好的解决方法吗?

或者说如何给html增加登陆的权限验证?

阅读 1.7k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题