在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Java/ springboot默認配置無法訪問ftl文件

springboot默認配置無法訪問ftl文件

在使用springboot默認配置的情況下,通過返回ModelAndView無法訪問到相應的ftl文件。

這是基本yml配置文件:

spring:
  jpa:
    show-sql: true
  jackson:
    default-property-inclusion: non_null
server:
  context-path: /sell

這是Controller文件:

@Controller
@RequestMapping("/seller/order")
@Slf4j
public class SellerOrderController     {
    @GetMapping("/list")
    public ModelAndView list(@RequestParam(value = "page", defaultValue = "1") Integer page,
                             @RequestParam(value = "size", defaultValue = "2") Integer size,
                             Map<String, Object> map) {
        
        map.put("currentPage", page);
        map.put("size", size);
        return new ModelAndView("order/list", map);
    }
}

這是工程結構:

clipboard.png

這個問題出在哪兒呀,如果請求的是ResponseBody,是完全沒有問題的,只有在請求相關的靜態(tài)頁面的時候無法訪問到。

回答
編輯回答
眼雜

clipboard.png
這是項目結構,實際上在我debug的時候是可以進入到controller中的,在返回view的時候報404錯誤

return new ModelAndView("order/list", map);

這是報錯信息:

 Whitelabel Error Page
    This application has no explicit mapping for /error, so you are seeing this as a fallback.
    
    Fri Jan 12 00:11:49 CST 2018
    There was an unexpected error (type=Not Found, status=404).
    No message available
2017年10月12日 02:20
編輯回答
旖襯

沒有加視圖模板freemarker的依賴
<dependency>

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

</dependency>

2017年8月9日 08:02
編輯回答
舊螢火

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

spring.freemarker.template-loader-path=classpath:/templates/

這是我的配置

2018年7月10日 22:55