搜尋

首頁  >  問答  >  主體

java - 使用velocity报错

为什么报这个错?


2016-12-04 19:29:29,752 ERROR [http-nio-8080-exec-5] org.apache.velocity - ResourceManager : unable to find resource '/user/logintrack.json.vm' in any resource loader.
2016-12-04 19:30:40,527 ERROR [http-nio-8080-exec-4] org.apache.velocity - ResourceManager : unable to find resource '/user/useraudit.json.vm' in any resource loader.
2016-12-04 19:30:44,208 ERROR [http-nio-8080-exec-7] org.apache.velocity - ResourceManager : unable to find resource '/user/useredit.json.vm' in any resource loader.
2016-12-04 19:30:49,472 ERROR [http-nio-8080-exec-6] org.apache.velocity - ResourceManager : unable to find resource '/user/reset.json.vm' in any resource loader.
2016-12-04 19:30:50,637 ERROR [http-nio-8080-exec-8] org.apache.velocity - ResourceManager : unable to find resource '/user/userlogin.json.vm' in any resource loader.
PHP中文网PHP中文网2818 天前705

全部回覆(3)我來回復

  • 怪我咯

    怪我咯2017-04-18 10:29:03

    設定resource了嗎

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/mystatic/**")
                .addResourceLocations("classpath:/mystatic/");
    }

    回覆
    0
  • 怪我咯

    怪我咯2017-04-18 10:29:03

    配置了 前端回傳都是200ok 後端會打error出來

    回覆
    0
  • 黄舟

    黄舟2017-04-18 10:29:03

    要配置resource。
    最簡單就是把將velocity檔案放入src/main/resources/templates,模板檔案後綴.vm。依照springboot預設設定

    回覆
    0
  • 取消回覆