From dbd7f97f1e1b9789b1dd98218dadac09403b5214 Mon Sep 17 00:00:00 2001 From: DadySu <32805872+DadySu@users.noreply.github.com> Date: Wed, 20 Feb 2019 19:06:46 +0800 Subject: [PATCH 1/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c4326e..ba00929 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # feastManager -代码很low,拜拜 +代码很low,请勿停留 From 125db7eac4223bbef2e562f1dd89a28681b1df4d Mon Sep 17 00:00:00 2001 From: DadySu <32805872+DadySu@users.noreply.github.com> Date: Wed, 20 Feb 2019 19:08:21 +0800 Subject: [PATCH 2/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ba00929..4757a11 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # feastManager 代码很low,请勿停留 + +使用idea构建docker镜像:https://my.oschina.net/wuweixiang/blog/2874064 From ec8a8677022d6849954639d45df52c190e98c1a0 Mon Sep 17 00:00:00 2001 From: liubo <672304928@qq.com> Date: Mon, 4 Mar 2019 15:22:40 +0800 Subject: [PATCH 3/5] today pm2.5 68 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3c4326e..2c3f05d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # feastManager -代码很low,拜拜 +代码很low,拜拜! From c6071e946e3d599079a9d1308c15c2921945a8f3 Mon Sep 17 00:00:00 2001 From: liubo <672304928@qq.com> Date: Tue, 21 May 2019 17:03:11 +0800 Subject: [PATCH 4/5] today pm2.5 34 --- .../com/up/feast/config/AnimalConfig.java | 53 ++++++++++++ .../up/feast/configuration/CorsConfig.java | 4 +- .../up/feast/controller/DemoController.java | 4 +- .../up/feast/controller/ImgController.java | 81 +++++++++++++++++++ feast-api/src/main/resources/application.yml | 2 +- .../src/main/resources/logback-spring.xml | 2 +- 6 files changed, 141 insertions(+), 5 deletions(-) create mode 100644 feast-api/src/main/java/com/up/feast/config/AnimalConfig.java create mode 100644 feast-api/src/main/java/com/up/feast/controller/ImgController.java diff --git a/feast-api/src/main/java/com/up/feast/config/AnimalConfig.java b/feast-api/src/main/java/com/up/feast/config/AnimalConfig.java new file mode 100644 index 0000000..14b28fc --- /dev/null +++ b/feast-api/src/main/java/com/up/feast/config/AnimalConfig.java @@ -0,0 +1,53 @@ +package com.up.feast.config; + +import com.ulisesbocchio.jasyptspringboot.annotation.ConditionalOnMissingBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Description + * + * @author liub + * @date 2019-03-19 15:15 + */ +@Configuration +public class AnimalConfig { + + @Bean(name = "animal1") + public Animal getAnimal1() { + return new Animal("小白", 2); + } + + @Bean(name = "animal1") + @ConditionalOnMissingBean + public Animal getAnimal2() { + return new Animal("小黑", 3); + } + + + class Animal { + + private String name; + + private Integer age; + + public Animal() { + + } + + public Animal(String name, Integer age) { + this.name = name; + this.age = age; + } + } + + class Dog extends Animal { + public Dog(String name, Integer age) { + super(name, age); + } + } + + class Cat extends Animal { + + } +} diff --git a/feast-api/src/main/java/com/up/feast/configuration/CorsConfig.java b/feast-api/src/main/java/com/up/feast/configuration/CorsConfig.java index 239c7c9..d57c861 100644 --- a/feast-api/src/main/java/com/up/feast/configuration/CorsConfig.java +++ b/feast-api/src/main/java/com/up/feast/configuration/CorsConfig.java @@ -7,6 +7,7 @@ /** * Description 跨域配置类 + * * @author liub * @date 2018-11-28 14:33 */ @@ -14,8 +15,7 @@ public class CorsConfig { @Bean - public WebMvcConfigurer corsConfigurer() - { + public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { diff --git a/feast-api/src/main/java/com/up/feast/controller/DemoController.java b/feast-api/src/main/java/com/up/feast/controller/DemoController.java index 19398cc..b5b7217 100644 --- a/feast-api/src/main/java/com/up/feast/controller/DemoController.java +++ b/feast-api/src/main/java/com/up/feast/controller/DemoController.java @@ -36,6 +36,8 @@ public String demo(@RequestBody String requestBody){ @GetMapping("/test") @TestAnnotation(address = "shenyang", condition = TestAnnotation.age.kid) public String test() { - return "原来你是我最想留住的幸运,原来我们的爱情曾经靠的那么近..."; + log.info("info log"); + log.debug("debug log"); + return "test"; } } diff --git a/feast-api/src/main/java/com/up/feast/controller/ImgController.java b/feast-api/src/main/java/com/up/feast/controller/ImgController.java new file mode 100644 index 0000000..307cf5b --- /dev/null +++ b/feast-api/src/main/java/com/up/feast/controller/ImgController.java @@ -0,0 +1,81 @@ +package com.up.feast.controller; + +import base.BaseResponse; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; +import sun.misc.BASE64Encoder; + +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.util.HashMap; +import java.util.Map; + +/** + * Description + * + * @author liub + * @date 2019-04-10 12:40 + */ +@Api(tags = "下载图片接口") +@Slf4j +@RestController +public class ImgController { + + + @GetMapping("/downloadImg") + public String downloadImg(HttpServletResponse response) throws Exception { + response.setHeader("Content-Disposition", + "attachment;fileName=" + "headPic.jpg"); + File imgFile = new File("D:\\selfWorkspace\\feastManager\\Logo.jpg"); + responseFile(response, imgFile); + return "true"; + } + + private void responseFile(HttpServletResponse response, File imgFile) { + try (InputStream is = new FileInputStream(imgFile); + OutputStream os = response.getOutputStream()) { + // 图片文件流缓存池 + byte[] buffer = new byte[1024]; + while (is.read(buffer) != -1) { + os.write(buffer); + } + os.flush(); + } catch (IOException ioe) { + ioe.printStackTrace(); + } + } + + + @GetMapping("/baseImg") + public String baseImg() { + log.info("base64img"); + InputStream in = null; + byte[] data = null; + //读取图片字节数组 + try { + in = new FileInputStream("D:\\selfWorkspace\\feastManager\\Logo.jpg"); + data = new byte[in.available()]; + in.read(data); + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + //对字节数组Base64编码 + BASE64Encoder encoder = new BASE64Encoder(); + //返回Base64编码过的字节数组字符串 + return encoder.encode(data); + } + + + @GetMapping("/testResponse") + public BaseResponse testResponse() { + BaseResponse response = BaseResponse.newInstanceSuccess(); + Map map = new HashMap<>(1); + map.put("uniqueCode", "1515616"); + response.setBody(map); + + return response; + } +} diff --git a/feast-api/src/main/resources/application.yml b/feast-api/src/main/resources/application.yml index 08119a3..dbfc124 100644 --- a/feast-api/src/main/resources/application.yml +++ b/feast-api/src/main/resources/application.yml @@ -26,7 +26,7 @@ mybatis: tom: age: ${random.int} server: - port: 8080 + port: 80 logging: config: classpath:logback-spring.xml diff --git a/feast-api/src/main/resources/logback-spring.xml b/feast-api/src/main/resources/logback-spring.xml index f4c7214..2c26e34 100644 --- a/feast-api/src/main/resources/logback-spring.xml +++ b/feast-api/src/main/resources/logback-spring.xml @@ -44,7 +44,7 @@ - + From 92c8d4486021290c4e1bca5c17645fc5eba7e58a Mon Sep 17 00:00:00 2001 From: liubo <672304928@qq.com> Date: Tue, 21 May 2019 17:06:05 +0800 Subject: [PATCH 5/5] today pm2.5 34 --- feast-api/pom.xml | 5 ----- feast-common/pom.xml | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/feast-api/pom.xml b/feast-api/pom.xml index 10667b6..5e608de 100644 --- a/feast-api/pom.xml +++ b/feast-api/pom.xml @@ -77,11 +77,6 @@ org.springframework.boot spring-boot-starter-data-redis --> - - com.alibaba - fastjson - 1.2.6 - org.springframework.boot spring-boot-starter-aop diff --git a/feast-common/pom.xml b/feast-common/pom.xml index e53e36e..0d52bf2 100644 --- a/feast-common/pom.xml +++ b/feast-common/pom.xml @@ -83,7 +83,7 @@ com.alibaba fastjson - 1.2.6 + 1.2.31 commons-io