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