<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