diff --git a/spring-boot-template-freemarker/.gitignore b/spring-boot-demo-template-freemarker/.gitignore similarity index 100% rename from spring-boot-template-freemarker/.gitignore rename to spring-boot-demo-template-freemarker/.gitignore diff --git a/spring-boot-template-freemarker/README.md b/spring-boot-demo-template-freemarker/README.md similarity index 99% rename from spring-boot-template-freemarker/README.md rename to spring-boot-demo-template-freemarker/README.md index e6b77ae..3ad54a5 100644 --- a/spring-boot-template-freemarker/README.md +++ b/spring-boot-demo-template-freemarker/README.md @@ -1,4 +1,4 @@ -# spring-boot-template-freemarker +# spring-boot-demo-template-freemarker > 本 demo 主要演示了 Spring Boot 项目如何集成 freemarker 模板引擎 diff --git a/spring-boot-template-freemarker/pom.xml b/spring-boot-demo-template-freemarker/pom.xml similarity index 91% rename from spring-boot-template-freemarker/pom.xml rename to spring-boot-demo-template-freemarker/pom.xml index 735c279..7bd7bc6 100644 --- a/spring-boot-template-freemarker/pom.xml +++ b/spring-boot-demo-template-freemarker/pom.xml @@ -4,11 +4,11 @@ 4.0.0 com.xkcoding - spring-boot-template-freemarker + spring-boot-demo-template-freemarker 0.0.1-SNAPSHOT jar - spring-boot-template-freemarker + spring-boot-demo-template-freemarker Demo project for Spring Boot @@ -55,7 +55,7 @@ - spring-boot-template-freemarker + spring-boot-demo-template-freemarker org.springframework.boot diff --git a/spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/SpringBootTemplateFreemarkerApplication.java b/spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/SpringBootDemoTemplateFreemarkerApplication.java similarity index 77% rename from spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/SpringBootTemplateFreemarkerApplication.java rename to spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/SpringBootDemoTemplateFreemarkerApplication.java index 9c9870d..bd01c29 100644 --- a/spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/SpringBootTemplateFreemarkerApplication.java +++ b/spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/SpringBootDemoTemplateFreemarkerApplication.java @@ -17,9 +17,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; * @modified: yangkai.shen */ @SpringBootApplication -public class SpringBootTemplateFreemarkerApplication { +public class SpringBootDemoTemplateFreemarkerApplication { public static void main(String[] args) { - SpringApplication.run(SpringBootTemplateFreemarkerApplication.class, args); + SpringApplication.run(SpringBootDemoTemplateFreemarkerApplication.class, args); } } diff --git a/spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/IndexController.java b/spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/IndexController.java similarity index 96% rename from spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/IndexController.java rename to spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/IndexController.java index ce4939f..d06aa4e 100644 --- a/spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/IndexController.java +++ b/spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/IndexController.java @@ -34,7 +34,7 @@ public class IndexController { if (ObjectUtil.isNull(user)) { mv.setViewName("redirect:/user/login"); } else { - mv.setViewName("index"); + mv.setViewName("page/index"); mv.addObject(user); } diff --git a/spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/UserController.java b/spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/UserController.java similarity index 96% rename from spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/UserController.java rename to spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/UserController.java index 73ffed1..0631e06 100644 --- a/spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/UserController.java +++ b/spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/controller/UserController.java @@ -40,6 +40,6 @@ public class UserController { @GetMapping("/login") public ModelAndView login() { - return new ModelAndView("login"); + return new ModelAndView("page/login"); } } diff --git a/spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/model/User.java b/spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/model/User.java similarity index 100% rename from spring-boot-template-freemarker/src/main/java/com/xkcoding/template/freemarker/model/User.java rename to spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/model/User.java diff --git a/spring-boot-demo-template-freemarker/src/main/resources/application.yml b/spring-boot-demo-template-freemarker/src/main/resources/application.yml new file mode 100644 index 0000000..754e88b --- /dev/null +++ b/spring-boot-demo-template-freemarker/src/main/resources/application.yml @@ -0,0 +1,8 @@ +server: + port: 8080 + servlet: + context-path: /demo +spring: + freemarker: + suffix: .ftl + cache: false \ No newline at end of file diff --git a/spring-boot-template-freemarker/src/main/resources/templates/common/head.ftl b/spring-boot-demo-template-freemarker/src/main/resources/templates/common/head.ftl similarity index 100% rename from spring-boot-template-freemarker/src/main/resources/templates/common/head.ftl rename to spring-boot-demo-template-freemarker/src/main/resources/templates/common/head.ftl diff --git a/spring-boot-template-freemarker/src/main/resources/templates/index.ftl b/spring-boot-demo-template-freemarker/src/main/resources/templates/page/index.ftl similarity index 76% rename from spring-boot-template-freemarker/src/main/resources/templates/index.ftl rename to spring-boot-demo-template-freemarker/src/main/resources/templates/page/index.ftl index a9a03bd..7305715 100644 --- a/spring-boot-template-freemarker/src/main/resources/templates/index.ftl +++ b/spring-boot-demo-template-freemarker/src/main/resources/templates/page/index.ftl @@ -1,6 +1,6 @@ -<#include "./common/head.ftl"> +<#include "../common/head.ftl">
欢迎登录,${user.name}! diff --git a/spring-boot-template-freemarker/src/main/resources/templates/login.ftl b/spring-boot-demo-template-freemarker/src/main/resources/templates/page/login.ftl similarity index 89% rename from spring-boot-template-freemarker/src/main/resources/templates/login.ftl rename to spring-boot-demo-template-freemarker/src/main/resources/templates/page/login.ftl index c019094..7828b9a 100644 --- a/spring-boot-template-freemarker/src/main/resources/templates/login.ftl +++ b/spring-boot-demo-template-freemarker/src/main/resources/templates/page/login.ftl @@ -1,6 +1,6 @@ -<#include "./common/head.ftl"> +<#include "../common/head.ftl">
diff --git a/spring-boot-template-freemarker/src/test/java/com/xkcoding/template/freemarker/SpringBootTemplateFreemarkerApplicationTests.java b/spring-boot-demo-template-freemarker/src/test/java/com/xkcoding/template/freemarker/SpringBootDemoTemplateFreemarkerApplicationTests.java similarity index 82% rename from spring-boot-template-freemarker/src/test/java/com/xkcoding/template/freemarker/SpringBootTemplateFreemarkerApplicationTests.java rename to spring-boot-demo-template-freemarker/src/test/java/com/xkcoding/template/freemarker/SpringBootDemoTemplateFreemarkerApplicationTests.java index 76d15f2..5f21f9b 100644 --- a/spring-boot-template-freemarker/src/test/java/com/xkcoding/template/freemarker/SpringBootTemplateFreemarkerApplicationTests.java +++ b/spring-boot-demo-template-freemarker/src/test/java/com/xkcoding/template/freemarker/SpringBootDemoTemplateFreemarkerApplicationTests.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class SpringBootTemplateFreemarkerApplicationTests { +public class SpringBootDemoTemplateFreemarkerApplicationTests { @Test public void contextLoads() { diff --git a/spring-boot-template-freemarker/src/main/resources/application.yml b/spring-boot-template-freemarker/src/main/resources/application.yml deleted file mode 100644 index a02fbde..0000000 --- a/spring-boot-template-freemarker/src/main/resources/application.yml +++ /dev/null @@ -1,4 +0,0 @@ -server: - port: 8080 - servlet: - context-path: /demo \ No newline at end of file