整合freemarker,訪問(wèn)不到ftl的頁(yè)面,直接返回了字符串
在pom.xml文件中添加了
<!--?引入freemarker模板依賴(lài)?--> <dependency> ???<groupId>org.springframework.boot</groupId> ???<artifactId>spring-boot-starter-freemarker</artifactId> </dependency>
在配置文件中也添加了相關(guān)配置
controller中的代碼
項(xiàng)目結(jié)構(gòu)是這樣的
項(xiàng)目訪問(wèn)的結(jié)果是
幫忙看看,謝謝
2019-03-02
在controller中,你是使用了RestController注解,相當(dāng)于是Controller和ResponseBody一起使用了,默認(rèn)會(huì)將返回值按照json格式解析;這里是整合freemarker是spring?mvc的方式,使用Controller加上兩個(gè)RequestMapping即可,所以是你的注解使用錯(cuò)了