<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
spring:
freemarker:
cache: false
爲了實現熱部署,這裏僅配置一下freemarker的緩存,關於freemarker的其它配置使用默認便可。css
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
請看說明:${descrip} <br />
haahaaaa
</body>
</html>
@Controller
public class FreemarkerController {
@RequestMapping("/demo")
public String demo(Map<String, Object> map) {
map.put("descrip", "It's a springboot integrate freemarker's demo!!!!");
return "demo";
}
}
@SpringBootApplication
public class Application {
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
源代碼連接:https://github.com/myNameIssls/springboot-study
參考連接:https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples
關於springboot配置文件中的屬性及freemarker的配置可參考連接:
http://docs.spring.io/spring-boot/docs/1.5.3.RELEASE/reference/htmlsingle/#appendixhtml