From 337a6285dd2fcdaaf0bf5e43090fdc27a7c42037 Mon Sep 17 00:00:00 2001 From: wangsong Date: Mon, 1 Mar 2021 20:49:57 +0800 Subject: [PATCH] m --- flash_map/pom.xml | 41 +++++++++++++++++ .../flash_map/FlashMapApplication.java | 13 ++++++ .../javaboy/flash_map/OrderController.java | 45 +++++++++++++++++++ .../src/main/resources/application.properties | 1 + flash_map/src/main/resources/static/01.html | 12 +++++ .../flash_map/FlashMapApplicationTests.java | 13 ++++++ logging-spring-boot-starter/pom.xml | 2 +- .../java/org/javaboy/logging/TimeLog.java | 2 +- logging_test/pom.xml | 2 +- .../src/main/resources/application.properties | 4 +- .../src/main/resources/application.properties | 2 +- 11 files changed, 131 insertions(+), 6 deletions(-) create mode 100644 flash_map/pom.xml create mode 100644 flash_map/src/main/java/org/javaboy/flash_map/FlashMapApplication.java create mode 100644 flash_map/src/main/java/org/javaboy/flash_map/OrderController.java create mode 100644 flash_map/src/main/resources/application.properties create mode 100644 flash_map/src/main/resources/static/01.html create mode 100644 flash_map/src/test/java/org/javaboy/flash_map/FlashMapApplicationTests.java diff --git a/flash_map/pom.xml b/flash_map/pom.xml new file mode 100644 index 0000000..a30d3f1 --- /dev/null +++ b/flash_map/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.4.3 + + + org.javaboy + flash_map + 0.0.1-SNAPSHOT + flash_map + Demo project for Spring Boot + + 11 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/flash_map/src/main/java/org/javaboy/flash_map/FlashMapApplication.java b/flash_map/src/main/java/org/javaboy/flash_map/FlashMapApplication.java new file mode 100644 index 0000000..adc8006 --- /dev/null +++ b/flash_map/src/main/java/org/javaboy/flash_map/FlashMapApplication.java @@ -0,0 +1,13 @@ +package org.javaboy.flash_map; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class FlashMapApplication { + + public static void main(String[] args) { + SpringApplication.run(FlashMapApplication.class, args); + } + +} diff --git a/flash_map/src/main/java/org/javaboy/flash_map/OrderController.java b/flash_map/src/main/java/org/javaboy/flash_map/OrderController.java new file mode 100644 index 0000000..422ce76 --- /dev/null +++ b/flash_map/src/main/java/org/javaboy/flash_map/OrderController.java @@ -0,0 +1,45 @@ +package org.javaboy.flash_map; + +import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import org.springframework.web.servlet.DispatcherServlet; +import org.springframework.web.servlet.FlashMap; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; + +import javax.servlet.http.HttpServletRequest; + +/** + * @author 江南一点雨 + * @微信公众号 江南一点雨 + * @网站 http://www.itboyhub.com + * @国际站 http://www.javaboy.org + * @微信 a_java_boy + * @GitHub https://github.com/lenve + * @Gitee https://gitee.com/lenve + */ +@Controller +public class OrderController { + @PostMapping("/order") + public String order(HttpServletRequest req) { + FlashMap flashMap = (FlashMap) req.getAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE); + flashMap.put("site", "www.javaboy.org"); + flashMap.addTargetRequestParam("aa", "bb"); +// attr.addFlashAttribute("site", "www.javaboy.org"); +// attr.addAttribute("name", "微信公众号:江南一点雨"); + return "redirect:/orderlist?aa=bb"; + } + + @GetMapping("/orderlist") + @ResponseBody + public String orderList(Model model) { + return (String) model.getAttribute("site"); + } +} diff --git a/flash_map/src/main/resources/application.properties b/flash_map/src/main/resources/application.properties new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/flash_map/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/flash_map/src/main/resources/static/01.html b/flash_map/src/main/resources/static/01.html new file mode 100644 index 0000000..7a58be2 --- /dev/null +++ b/flash_map/src/main/resources/static/01.html @@ -0,0 +1,12 @@ + + + + + Title + + +
+ +
+ + \ No newline at end of file diff --git a/flash_map/src/test/java/org/javaboy/flash_map/FlashMapApplicationTests.java b/flash_map/src/test/java/org/javaboy/flash_map/FlashMapApplicationTests.java new file mode 100644 index 0000000..8c6f5d1 --- /dev/null +++ b/flash_map/src/test/java/org/javaboy/flash_map/FlashMapApplicationTests.java @@ -0,0 +1,13 @@ +package org.javaboy.flash_map; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class FlashMapApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/logging-spring-boot-starter/pom.xml b/logging-spring-boot-starter/pom.xml index ff2f85b..71f5fd1 100644 --- a/logging-spring-boot-starter/pom.xml +++ b/logging-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ 4.0.0 logging-spring-boot-starter - 0.1 + 0.0.1 org.springframework.boot diff --git a/logging-spring-boot-starter/src/main/java/org/javaboy/logging/TimeLog.java b/logging-spring-boot-starter/src/main/java/org/javaboy/logging/TimeLog.java index 79184cc..e469740 100644 --- a/logging-spring-boot-starter/src/main/java/org/javaboy/logging/TimeLog.java +++ b/logging-spring-boot-starter/src/main/java/org/javaboy/logging/TimeLog.java @@ -6,7 +6,7 @@ import java.lang.annotation.Target; /** - * @author 江南一点雨 + * @author 江南一点雨 jitpack * @微信公众号 江南一点雨 * @网站 http://www.itboyhub.com * @国际站 http://www.javaboy.org diff --git a/logging_test/pom.xml b/logging_test/pom.xml index 56d0bd9..78277d2 100644 --- a/logging_test/pom.xml +++ b/logging_test/pom.xml @@ -27,7 +27,7 @@ org.springframework.boot logging-spring-boot-starter - 0.1 + 0.0.1 diff --git a/logging_test/src/main/resources/application.properties b/logging_test/src/main/resources/application.properties index 50778de..7ae17d9 100644 --- a/logging_test/src/main/resources/application.properties +++ b/logging_test/src/main/resources/application.properties @@ -1,3 +1,3 @@ -logging.config=classpath:log.xml +#logging.config=classpath:log.xml -time.log.enable=false \ No newline at end of file +#time.log.enable=false \ No newline at end of file diff --git a/swagger2/src/main/resources/application.properties b/swagger2/src/main/resources/application.properties index 8b13789..975296d 100644 --- a/swagger2/src/main/resources/application.properties +++ b/swagger2/src/main/resources/application.properties @@ -1 +1 @@ - +#server.port=8081 \ No newline at end of file