shotLog(@RequestBody String parms){
return result;
}
+ @RequestMapping("s")
+ public String ss() {
+ return "123";
+ }
+
+ @GetMapping("/exception")
+ public String exce() {
+ System.out.println("异常");
+ throw new IllegalArgumentException("异常了");
+ }
+
}
diff --git a/quick-log/src/main/java/com/quick/log/service/LoggerService.java b/quick-log/src/main/java/com/quick/log/service/LoggerService.java
index e6bb8654..360bacd4 100644
--- a/quick-log/src/main/java/com/quick/log/service/LoggerService.java
+++ b/quick-log/src/main/java/com/quick/log/service/LoggerService.java
@@ -1,13 +1,10 @@
package com.quick.log.service;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.MarkerManager;
import org.springframework.stereotype.Component;
-import javax.annotation.PostConstruct;
-
/**
* @Author: wangxc
* @GitHub: https://github.com/vector4wang
@@ -16,21 +13,17 @@
* @wxid: BMHJQS
*/
@Component
+@Slf4j
public class LoggerService {
- private Logger logger = LogManager.getLogger(LoggerService.class);
// @PostConstruct
public void showLog() {
// for (int i = 0; i < 10; i++) {
- logger.debug("我是DEBUG日志");
- logger.info("我是INFO日志");
- logger.warn("我是WARN日志");
- logger.error("我是ERROR日志");
- Marker marker = MarkerManager.getMarker("test");
- logger.error(marker,"我是ERROR日志");
-
- logger.fatal("我是FATAL日志");
+ log.debug("我是DEBUG日志");
+ log.info("我是INFO日志");
+ log.warn("我是WARN日志");
+ log.error("我是ERROR日志");
// }
}
diff --git a/quick-log/src/main/java/com/quick/log/util/LogExceptionUtil.java b/quick-log/src/main/java/com/quick/log/util/LogExceptionUtil.java
new file mode 100644
index 00000000..7150dd53
--- /dev/null
+++ b/quick-log/src/main/java/com/quick/log/util/LogExceptionUtil.java
@@ -0,0 +1,21 @@
+package com.quick.log.util;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * 有的时候想把Exception 所有的退债信息写在日志里,通过下面方法则可以实现
+ */
+public class LogExceptionUtil {
+
+ /**
+ * 在日志文件中,打印异常堆栈
+ * @param e
+ * @return
+ */
+ public static String LogExceptionStack(Exception e) {
+ StringWriter errorsWriter = new StringWriter();
+ e.printStackTrace(new PrintWriter(errorsWriter));
+ return System.getProperty("line.separator", "/n") + errorsWriter.toString();
+ }
+}
diff --git a/quick-log/src/main/resources/application-pro.properties b/quick-log/src/main/resources/application-pro.properties
new file mode 100644
index 00000000..8e8042ac
--- /dev/null
+++ b/quick-log/src/main/resources/application-pro.properties
@@ -0,0 +1,4 @@
+logging.config=classpath:log4j2.xml
+#logging.level.root=error
+
+server.port=8081
\ No newline at end of file
diff --git a/quick-log/src/main/resources/application.properties b/quick-log/src/main/resources/application.properties
index 00c01038..5d736291 100644
--- a/quick-log/src/main/resources/application.properties
+++ b/quick-log/src/main/resources/application.properties
@@ -1,4 +1,4 @@
logging.config=classpath:log4j2.xml
#logging.level.root=error
-server.port=80
\ No newline at end of file
+server.port=8084
\ No newline at end of file
diff --git a/quick-logback/pom.xml b/quick-logback/pom.xml
new file mode 100644
index 00000000..bd825ceb
--- /dev/null
+++ b/quick-logback/pom.xml
@@ -0,0 +1,38 @@
+
+
+ quick-logback
+ com.quick
+ 1.0-SNAPSHOT
+ 4.0.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.2.RELEASE
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
\ No newline at end of file
diff --git a/quick-logback/src/main/java/com/logback/Application.java b/quick-logback/src/main/java/com/logback/Application.java
new file mode 100644
index 00000000..4a7407d0
--- /dev/null
+++ b/quick-logback/src/main/java/com/logback/Application.java
@@ -0,0 +1,18 @@
+package com.logback;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * Created with IDEA
+ * User: vector
+ * Data: 2017/12/6
+ * Time: 17:14
+ * Description:
+ */
+@SpringBootApplication
+public class Application {
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+}
diff --git a/quick-logback/src/main/java/com/logback/controller/LogBackController.java b/quick-logback/src/main/java/com/logback/controller/LogBackController.java
new file mode 100644
index 00000000..a17e07d7
--- /dev/null
+++ b/quick-logback/src/main/java/com/logback/controller/LogBackController.java
@@ -0,0 +1,29 @@
+package com.logback.controller;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class LogBackController {
+ private Logger logger = LoggerFactory.getLogger(this.getClass());
+
+
+ @RequestMapping(value = "/logback")
+ @ResponseBody
+ public String logback() {
+ for (int i = 0; i < 100000; i++) {
+ // 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR <
+ // FATAL,如果设置为WARN,则低于WARN的信息都不会输出。
+ logger.trace("日志输出 trace");
+ logger.debug("日志输出 debug");
+ logger.info("日志输出 info");
+ logger.warn("日志输出 warn");
+ logger.error("日志输出 error");
+ }
+ return "Hello world";
+ }
+
+}
\ No newline at end of file
diff --git a/quick-logback/src/main/resources/application.properties b/quick-logback/src/main/resources/application.properties
new file mode 100644
index 00000000..43ed4a94
--- /dev/null
+++ b/quick-logback/src/main/resources/application.properties
@@ -0,0 +1,4 @@
+server.port=8080
+
+# TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF
+logging.level.*=INFO
\ No newline at end of file
diff --git a/quick-logback/src/main/resources/logback-spring.xml b/quick-logback/src/main/resources/logback-spring.xml
new file mode 100644
index 00000000..7a4efb65
--- /dev/null
+++ b/quick-logback/src/main/resources/logback-spring.xml
@@ -0,0 +1,80 @@
+
+
+ logback
+
+
+
+
+
+ ${CONSOLE_LOG_PATTERN}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ logs/app.log
+
+ logs/app-%d{yyyy-MM-dd}.log
+ 30
+ 1GB
+
+
+
+
+
+
+
+ %d{yyyy-mm-dd HH:mm:ss.SSS} [%thread] %-5level %logger{16} - %msg%n
+
+
+
+
+
+ ERROR
+
+ logs/error.log
+
+ logs/error-%d{yyyy-MM-dd}.log
+ 30
+ 1GB
+
+
+ %d{yyyy-mm-dd HH:mm:ss.SSS} [%thread] %-5level %logger{16} - %msg%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/quick-lombok/pom.xml b/quick-lombok/pom.xml
new file mode 100644
index 00000000..efa7bbf2
--- /dev/null
+++ b/quick-lombok/pom.xml
@@ -0,0 +1,57 @@
+
+
+ quick-lombok
+ com.quick
+ 1.0-SNAPSHOT
+ 4.0.0
+
+ 官方Doc:https://projectlombok.org/features/all
+
+
+
+ org.projectlombok
+ lombok
+ 1.18.2
+
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.30
+
+
+ org.slf4j
+ slf4j-simple
+ 1.7.30
+
+
+
+
+ org.apache.commons
+ commons-lang3
+ 3.4
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.6.0
+
+ 1.8
+ 1.8
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/quick-lombok/src/main/java/com/lombok/BuilderTestMain.java b/quick-lombok/src/main/java/com/lombok/BuilderTestMain.java
new file mode 100644
index 00000000..abf665e5
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/BuilderTestMain.java
@@ -0,0 +1,17 @@
+package com.lombok;
+
+import com.lombok.entity.Adult;
+
+/**
+ * @Builder:用在类、构造器、方法上,为你提供复杂的builder APIs,让你可以像如下方式一样调用Person.builder().name("Adam Savage").city("San Francisco").job("Mythbusters").job("Unchained Reaction").build();
+ * @Singular
+ * @author vector
+ * @date: 2019/2/27 0027 10:50
+ */
+public class BuilderTestMain {
+ public static void main(String[] args) {
+ Adult build = Adult.builder().age(10).cd("q").cd("e").cd("w").name("zxc").build();
+ System.out.println(build);
+
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/CleanupTestMain.java b/quick-lombok/src/main/java/com/lombok/CleanupTestMain.java
new file mode 100644
index 00000000..dd87583c
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/CleanupTestMain.java
@@ -0,0 +1,41 @@
+package com.lombok;
+
+import lombok.Cleanup;
+
+import java.io.*;
+
+/**
+ * @author vector
+ * `@Cleanup:自动管理资源,用在局部变量之前,在当前变量范围内即将执行完毕退出之前会自动清理资源,自动生成try-finally这样的代码来关闭流
+ * @date: 2019/2/27 0027 10:03
+ */
+public class CleanupTestMain {
+ public static void main(String[] args) {
+
+ }
+
+ public static void cleanLB() {
+// try {
+// @Cleanup InputStream inputStream = new FileInputStream(new File(""));
+// } catch (FileNotFoundException e) {
+// e.printStackTrace();
+// }
+ }
+
+ public static void clean() {
+ InputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(new File(""));
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } finally {
+ if (inputStream != null) {
+ try {
+ inputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/DataTestMain.java b/quick-lombok/src/main/java/com/lombok/DataTestMain.java
new file mode 100644
index 00000000..97e0a78c
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/DataTestMain.java
@@ -0,0 +1,20 @@
+package com.lombok;
+
+import com.lombok.entity.Student;
+
+/**
+ * @author vector
+ * @date: 2019/2/27 0027 10:30
+ */
+public class DataTestMain {
+ public static void main(String[] args) {
+ Student student = new Student();
+ student.setClassNo("1");
+ student.setStuNo("asdf");
+ student.setAge(20);
+ student.setAddress("sasfasdf");
+
+
+ System.out.println(student);
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/GetSetTestMain.java b/quick-lombok/src/main/java/com/lombok/GetSetTestMain.java
new file mode 100644
index 00000000..78eefb14
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/GetSetTestMain.java
@@ -0,0 +1,39 @@
+package com.lombok;
+
+import com.lombok.entity.Person;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+/**
+ * @Getter/@Setter:用在属性上,再也不用自己手写setter和getter方法了,还可以指定访问范围
+ * @ToString:用在类上,可以自动覆写toString方法,当然还可以加其他参数,例如@ToString(exclude=”id”)排除id属性,或者@ToString(callSuper=true, includeFieldNames=true)调用父类的toString方法,包含所有属性
+ * @EqualsAndHashCode:用在类上,自动生成equals方法和hashCode方法
+ * @NoArgsConstructor, @RequiredArgsConstructor and @AllArgsConstructor:用在类上,自动生成无参构造和使用所有参数的构造函数以及把所有@NonNull属性作为参数的构造函数,如果指定staticName = “of”参数,同时还会生成一个返回类对象的静态工厂方法,比使用构造函数方便很多
+ *
+ * @Data:注解在类上,相当于同时使用了@ToString、@EqualsAndHashCode、@Getter、@Setter和@RequiredArgsConstrutor这些注解,对于POJO类十分有用
+ * @author vector
+ * @date: 2019/2/27 0027 10:05
+ */
+public class GetSetTestMain {
+ public static void main(String[] args) {
+ Person persion = new Person();
+
+
+ persion.setAddress("hahaha");
+ //persion.setName("test");// not access
+ persion.setAge(12);
+ persion.setBirthday(new Date());
+
+
+ System.out.println(persion.toString());
+
+
+ Person persion1 = new Person("hahah","深圳",11,new Date(),new ArrayList<>());
+
+ Person wxc = Person.of("wxc");
+ System.out.println(wxc);
+
+
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/GetterTestMain.java b/quick-lombok/src/main/java/com/lombok/GetterTestMain.java
new file mode 100644
index 00000000..42e068ad
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/GetterTestMain.java
@@ -0,0 +1,28 @@
+package com.lombok;
+
+import lombok.Getter;
+
+/**
+ * @Getter(lazy=true):可以替代经典的Double Check Lock样板代码
+ *
+ * @author vector
+ * @date: 2019/2/27 0027 11:00
+ */
+public class GetterTestMain {
+
+
+ @Getter(lazy = true)
+ private final double[] cached = expensive();
+
+ private double[] expensive() {
+ double[] result = new double[1000000];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = Math.asin(i);
+ }
+ return result;
+ }
+
+ public static void main(String[] args) {
+
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/LogTestMain.java b/quick-lombok/src/main/java/com/lombok/LogTestMain.java
new file mode 100644
index 00000000..58e72bfd
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/LogTestMain.java
@@ -0,0 +1,43 @@
+package com.lombok;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+
+import java.util.Date;
+
+/**
+ * @author vector
+ * @Log:根据不同的注解生成不同类型的log对象,但是实例名称都是log,有六种可选实现类
+ * @CommonsLog Creates log = org.apache.commons.logging.LogFactory.getLog(LogExample.class);
+ * @Log Creates log = java.util.logging.Logger.getLogger(LogExample.class.getName());
+ * @Log4j Creates log = org.apache.log4j.Logger.getLogger(LogExample.class);
+ * @Log4j2 Creates log = org.apache.logging.log4j.LogManager.getLogger(LogExample.class);
+ * @Slf4j Creates log = org.slf4j.LoggerFactory.getLogger(LogExample.class);
+ * @XSlf4j Creates log = org.slf4j.ext.XLoggerFactory.getXLogger(LogExample.class);
+ *
+ * 注意,需要引入对应的包
+ * @date: 2019/2/27 0027 11:02
+ */
+@Slf4j
+public class LogTestMain {
+
+ public static void main(String[] args) {
+ log.trace("test");
+ log.debug("test");
+ log.info("test");
+ log.warn("test");
+ log.error("test");
+
+ Date date = null;
+ try {
+ System.out.println(date.getTime());
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.info("==========================================");
+ log.error("error : {} ", e.getMessage());
+ log.error("error : {} ", e);
+ log.error("error : {},{} ", 1, e);
+ log.error("error: {}", ExceptionUtils.getStackTrace(e));
+ }
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/NonNullTestMain.java b/quick-lombok/src/main/java/com/lombok/NonNullTestMain.java
new file mode 100644
index 00000000..d5fe6bb3
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/NonNullTestMain.java
@@ -0,0 +1,32 @@
+package com.lombok;
+
+import lombok.NonNull;
+
+/**
+ * `@NonNull` 给方法参数增加这个注解会自动在方法内对该参数进行是否为空的校验,如果为空,则抛出NPE(NullPointerException)
+ *
+ * @author vector
+ * @date: 2019/2/27 0027 9:59
+ */
+public class NonNullTestMain {
+ public static void main(String[] args) {
+// notNullLB(null);
+ notNull(null);
+ }
+
+ /**
+ * Exception in thread "main" java.lang.NullPointerException: arg
+ * @param arg
+ */
+ public static void notNullLB(@NonNull String arg) {
+ System.out.println(arg.length());
+ }
+
+ /**
+ * Exception in thread "main" java.lang.NullPointerException
+ * @param arg
+ */
+ public static void notNull(String arg) {
+ System.out.println(arg.length());
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/SneakyThrowsTestMain.java b/quick-lombok/src/main/java/com/lombok/SneakyThrowsTestMain.java
new file mode 100644
index 00000000..86b34a84
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/SneakyThrowsTestMain.java
@@ -0,0 +1,39 @@
+package com.lombok;
+
+import lombok.SneakyThrows;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+
+/**
+ *
+ * @SneakyThrows:自动抛受检异常,而无需显式在方法上使用throws语句
+ * @author vector
+ * @date: 2019/2/27 0027 10:57
+ */
+public class SneakyThrowsTestMain {
+
+ @SneakyThrows()
+ public void read() {
+ InputStream inputStream = new FileInputStream("");
+ }
+ @SneakyThrows
+ public void write() {
+ throw new UnsupportedEncodingException();
+ }
+
+ //相当于
+ /**
+
+ * public void read() throws FileNotFoundException {
+ * InputStream inputStream = new FileInputStream("");
+ * }
+ * public void write() throws UnsupportedEncodingException {
+ * throw new UnsupportedEncodingException();
+ * }
+ *
+ */
+
+}
diff --git a/quick-lombok/src/main/java/com/lombok/SynchronizedTestMain.java b/quick-lombok/src/main/java/com/lombok/SynchronizedTestMain.java
new file mode 100644
index 00000000..70356542
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/SynchronizedTestMain.java
@@ -0,0 +1,24 @@
+package com.lombok;
+
+import lombok.Synchronized;
+
+/**
+ * @Synchronized:用在方法上,将方法声明为同步的,并自动加锁,而锁对象是一个私有的属性$lock或$LOCK,而java中的synchronized关键字锁对象是this,锁在this或者自己的类对象上存在副作用,就是你不能阻止非受控代码去锁this或者类对象,这可能会导致竞争条件或者其它线程错误
+ * @author vector
+ * @date: 2019/2/27 0027 10:59
+ */
+public class SynchronizedTestMain {
+ @Synchronized
+ public static void hello() {
+ System.out.println("world");
+ }
+ //相当于
+ /**
+ * private static final Object $LOCK = new Object[0];
+ * public static void hello() {
+ * synchronized ($LOCK) {
+ * System.out.println("world");
+ * }
+ * }
+ */
+}
diff --git a/quick-lombok/src/main/java/com/lombok/ValTestMain.java b/quick-lombok/src/main/java/com/lombok/ValTestMain.java
new file mode 100644
index 00000000..ee8fea8e
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/ValTestMain.java
@@ -0,0 +1,22 @@
+package com.lombok;
+
+import lombok.val;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+
+/**
+ * val:用在局部变量前面,相当于将变量声明为final
+ * @author vector
+ * @date: 2019/2/27 0027 9:52
+ */
+public class ValTestMain {
+ public static void main(String[] args) {
+ val sets = new HashSet<>();// ===> final Set sets = new HashSet<>();
+ val lists = new ArrayList<>();// ===> final List lists = new ArrayList<>();
+ val str = "123";// ===> final String str = "123";
+
+ System.out.println(str);
+
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/ValueTestMain.java b/quick-lombok/src/main/java/com/lombok/ValueTestMain.java
new file mode 100644
index 00000000..6c14b49a
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/ValueTestMain.java
@@ -0,0 +1,15 @@
+package com.lombok;
+
+import com.lombok.entity.Teacher;
+
+/**
+ * @Value:用在类上,是@Data的不可变形式,相当于为属性添加final声明,只提供getter方法,而不提供setter方法
+ * @author vector
+ * @date: 2019/2/27 0027 10:40
+ */
+public class ValueTestMain {
+ public static void main(String[] args) {
+ Teacher teacher = new Teacher("wxc");
+ // teacher.setSalary() 没有setter方法
+ }
+}
diff --git a/quick-lombok/src/main/java/com/lombok/entity/Adult.java b/quick-lombok/src/main/java/com/lombok/entity/Adult.java
new file mode 100644
index 00000000..cda7ef2e
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/entity/Adult.java
@@ -0,0 +1,21 @@
+package com.lombok.entity;
+
+import lombok.Builder;
+import lombok.Singular;
+import lombok.ToString;
+
+import java.util.List;
+
+/**
+ * @author vector
+ * @date: 2019/2/27 0027 10:50
+ */
+@Builder
+@ToString
+public class Adult {
+ private String name;
+ private int age;
+
+ @Singular
+ private List cds;
+}
diff --git a/quick-lombok/src/main/java/com/lombok/entity/Person.java b/quick-lombok/src/main/java/com/lombok/entity/Person.java
new file mode 100644
index 00000000..a39550ca
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/entity/Person.java
@@ -0,0 +1,34 @@
+package com.lombok.entity;
+
+import lombok.*;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author vector
+ * @date: 2019/2/27 0027 10:10
+ */
+@ToString(exclude = "age")
+@EqualsAndHashCode
+@NoArgsConstructor // 无参构造
+@RequiredArgsConstructor(staticName = "of") // @NonNull属性作为参数的构造函数
+@AllArgsConstructor // 所有参数的构造函数
+public class Person {
+ @Getter(AccessLevel.PRIVATE)
+ @Setter(AccessLevel.PRIVATE)
+ @NonNull
+ private String name;
+ @Getter
+ @Setter
+ private String address;
+ @Getter
+ @Setter
+ private int age;
+ @Getter
+ @Setter
+ private Date birthday;
+ @Getter
+ @Setter
+ private List tmp;
+}
diff --git a/quick-lombok/src/main/java/com/lombok/entity/Student.java b/quick-lombok/src/main/java/com/lombok/entity/Student.java
new file mode 100644
index 00000000..ff1b8ea2
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/entity/Student.java
@@ -0,0 +1,15 @@
+package com.lombok.entity;
+
+import lombok.Data;
+import lombok.ToString;
+
+/**
+ * @author vector
+ * @date: 2019/2/27 0027 10:30
+ */
+@Data
+@ToString(callSuper = true)
+public class Student extends Person {
+ private String stuNo;
+ private String classNo;
+}
diff --git a/quick-lombok/src/main/java/com/lombok/entity/Teacher.java b/quick-lombok/src/main/java/com/lombok/entity/Teacher.java
new file mode 100644
index 00000000..f9b58714
--- /dev/null
+++ b/quick-lombok/src/main/java/com/lombok/entity/Teacher.java
@@ -0,0 +1,14 @@
+package com.lombok.entity;
+
+import lombok.Value;
+
+/**
+ * @Value:用在类上,是@Data的不可变形式,相当于为属性添加final声明,只提供getter方法,而不提供setter方法
+ * @author vector
+ * @date: 2019/2/27 0027 10:40
+ */
+@Value
+public class Teacher extends Person {
+ private String salary;
+
+}
diff --git a/quick-mail/pom.xml b/quick-mail/pom.xml
new file mode 100644
index 00000000..8ef1c8e6
--- /dev/null
+++ b/quick-mail/pom.xml
@@ -0,0 +1,55 @@
+
+
+ quick-mail
+ 1.0-SNAPSHOT
+ 4.0.0
+
+
+ quick-platform
+ com.quick
+ 1.0-SNAPSHOT
+ ../quick-platform/pom.xml
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+
+
+
\ No newline at end of file
diff --git a/quick-mail/src/.DS_Store b/quick-mail/src/.DS_Store
new file mode 100644
index 00000000..9d52cd44
Binary files /dev/null and b/quick-mail/src/.DS_Store differ
diff --git a/quick-mail/src/main/.DS_Store b/quick-mail/src/main/.DS_Store
new file mode 100644
index 00000000..891bd22a
Binary files /dev/null and b/quick-mail/src/main/.DS_Store differ
diff --git a/quick-mail/src/main/java/.DS_Store b/quick-mail/src/main/java/.DS_Store
new file mode 100644
index 00000000..76f6f84d
Binary files /dev/null and b/quick-mail/src/main/java/.DS_Store differ
diff --git a/quick-mail/src/main/java/com/EmailApplication.java b/quick-mail/src/main/java/com/EmailApplication.java
new file mode 100644
index 00000000..d4cca261
--- /dev/null
+++ b/quick-mail/src/main/java/com/EmailApplication.java
@@ -0,0 +1,17 @@
+package com;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ *
+ * @author wangxc
+ * @date: 2020/5/6 下午9:50
+ *
+ */
+@SpringBootApplication
+public class EmailApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(EmailApplication.class);
+ }
+}
diff --git a/quick-mail/src/main/java/com/quick/.DS_Store b/quick-mail/src/main/java/com/quick/.DS_Store
new file mode 100644
index 00000000..d2034751
Binary files /dev/null and b/quick-mail/src/main/java/com/quick/.DS_Store differ
diff --git a/quick-mail/src/main/java/com/quick/mail/service/SendEmailService.java b/quick-mail/src/main/java/com/quick/mail/service/SendEmailService.java
new file mode 100644
index 00000000..e809374d
--- /dev/null
+++ b/quick-mail/src/main/java/com/quick/mail/service/SendEmailService.java
@@ -0,0 +1,217 @@
+package com.quick.mail.service;
+
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.mail.SimpleMailMessage;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.mail.javamail.MimeMessageHelper;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ResourceUtils;
+import org.thymeleaf.TemplateEngine;
+import org.thymeleaf.context.Context;
+
+
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeMessage;
+import java.io.File;
+import java.io.FileNotFoundException;
+
+/**
+ *
+ * @author wangxc
+ * @date: 2020/5/6 下午9:46
+ *
+ */
+@Service
+public class SendEmailService {
+
+
+ @Autowired
+ private JavaMailSender javaMailSender;
+
+ @Autowired
+ private TemplateEngine templateEngine;
+
+ /**
+ * 文本邮件
+ */
+ public void sendEmail() {
+ SimpleMailMessage msg = new SimpleMailMessage();
+ msg.setFrom("772704457@qq.com");
+ msg.setTo("vector4wang@gmail.com","wdc43101289217@126.com");
+ msg.setSubject("Testing from Spring Boot");
+ msg.setText("Hello World \n Spring Boot Email");
+ javaMailSender.send(msg);
+ }
+
+ /**
+ * 带图片
+ * @throws MessagingException
+ * @throws FileNotFoundException
+ */
+ public void sendImageEmail() throws MessagingException, FileNotFoundException {
+ MimeMessage message = javaMailSender.createMimeMessage();
+
+ MimeMessageHelper helper = new MimeMessageHelper(message, true);
+ helper.setFrom("772704457@qq.com");
+ helper.setTo(new String[]{"vector4wang@gmail.com","wdc43101289217@126.com"});
+ helper.setSubject("Testing from Spring Boot");
+ String rscId = "id";
+ helper.setText("这是有图片的邮件
", true);
+ FileSystemResource res = new FileSystemResource(ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "bang.jpeg"));
+ helper.addInline(rscId, res);
+ javaMailSender.send(message);
+ }
+
+ /**
+ * 带有html的邮件
+ */
+ public void sendHtmlEmail() throws MessagingException {
+ MimeMessage message = javaMailSender.createMimeMessage();
+
+ //true表示需要创建一个multipart message
+ MimeMessageHelper helper = new MimeMessageHelper(message, true);
+ helper.setFrom("772704457@qq.com");
+ helper.setTo(new String[]{"vector4wang@gmail.com","wdc43101289217@126.com"});
+ helper.setSubject("Testing from Spring Boot");
+// String htmlStr = new StringBuilder()
+// .append("\n")
+// .append(" \n")
+// .append("
恭喜你中奖了!
\n")
+// .append("
https://github.com/vector4wang/spring-boot-quick").append("
\n")
+// .append("
如果对你有帮助,请点赞收藏
\n")
+// .append("
\n").append("").toString();
+ String htmlContent = getHtmlContent();
+ helper.setText(htmlContent, true);
+ javaMailSender.send(message);
+ }
+
+ public void sendAttachmentMail() throws MessagingException, FileNotFoundException {
+ MimeMessage message = javaMailSender.createMimeMessage();
+
+ MimeMessageHelper helper = new MimeMessageHelper(message, true);
+ helper.setFrom("772704457@qq.com");
+ helper.setTo(new String[]{"vector4wang@gmail.com","wdc43101289217@126.com"});
+ helper.setSubject("Testing from Spring Boot");
+ helper.setText("带有附件的邮件", true);
+ File file = ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "bang.jpeg");
+ FileSystemResource fileSystemResource = new FileSystemResource(file);
+ helper.addAttachment(file.getName(), fileSystemResource);
+
+ javaMailSender.send(message);
+ }
+
+ public void sendTemplateEmail() throws MessagingException, FileNotFoundException {
+ Context context = new Context();
+ context.setVariable("project", "quick-springbooot");
+ context.setVariable("author", "vector4wang");
+ context.setVariable("url", "https://github.com/vector4wang/spring-boot-quick");
+ String emailContent = templateEngine.process("wel", context);
+
+ MimeMessage message = javaMailSender.createMimeMessage();
+
+ MimeMessageHelper helper = new MimeMessageHelper(message, true);
+ helper.setFrom("772704457@qq.com");
+ helper.setTo(new String[]{"vector4wang@gmail.com","wdc43101289217@126.com"});
+ helper.setSubject("Testing from Spring Boot");
+ helper.setText(emailContent, true);
+ helper.addInline("bang", ResourceUtils.getFile(ResourceUtils.CLASSPATH_URL_PREFIX + "bang.jpeg"));
+ javaMailSender.send(message);
+
+ }
+
+ public String getHtmlContent() {
+ String str = new StringBuilder().append("\n").append("\n").append("\n")
+ .append(" \n")
+ .append(" \n")
+ .append(" 邮件推送\n").append("\n").append("\n").append("\n")
+ .append(" \n").append(" \n").append("
\n")
+ .append("
\n")
+ .append("
\n").append(" 一号仓
\n")
+ .append(" \n").append(" 事件\n")
+ .append(" 人员告警\n").append(" |\n")
+ .append(" 作业车辆\n").append(" 无\n")
+ .append("
\n").append(" \n").append("
\n")
+ .append(" \n").append(" 事件信息\n")
+ .append("
\n").append(" \n")
+ .append("
\n").append("
\n")
+ .append(" 开始时间: \n")
+ .append(" 2020-3-15 00:00:00\n")
+ .append("
\n").append("
\n")
+ .append(" 结束时间: \n")
+ .append(" 2020-3-16 00:00:00\n")
+ .append("
\n").append("
\n")
+ .append("
\n").append(" 持续时长: \n")
+ .append(" 2.7h\n").append("
\n")
+ .append("
\n").append(" \n").append("
\n").append("
\n")
+ .append(" \n").append(" \n").append("
\n")
+ .append("
\n")
+ .append("
\n").append(" 一号仓
\n")
+ .append(" \n").append(" 事件\n")
+ .append(" 人员告警\n").append(" |\n")
+ .append(" 作业车辆\n").append(" 无\n")
+ .append("
\n").append(" \n").append("
\n")
+ .append(" \n").append(" 事件信息\n")
+ .append("
\n").append(" \n")
+ .append("
\n").append("
\n")
+ .append(" 开始时间: \n")
+ .append(" 2020-3-15 00:00:00\n")
+ .append("
\n").append("
\n")
+ .append(" 结束时间: \n")
+ .append(" 2020-3-16 00:00:00\n")
+ .append("
\n").append("
\n")
+ .append("
\n").append(" 持续时长: \n")
+ .append(" 2.7h\n").append("
\n")
+ .append("
\n").append(" \n").append("
\n").append("
\n")
+ .append(" \n").append(" \n").append("
\n")
+ .append("
\n")
+ .append("
\n").append(" 一号仓
\n")
+ .append(" \n").append(" 事件\n")
+ .append(" 人员告警\n").append(" |\n")
+ .append(" 作业车辆\n").append(" 无\n")
+ .append("
\n").append(" \n").append("
\n")
+ .append(" \n").append(" 事件信息\n")
+ .append("
\n").append(" \n")
+ .append("
\n").append("
\n")
+ .append(" 开始时间: \n")
+ .append(" 2020-3-15 00:00:00\n")
+ .append("
\n").append("
\n")
+ .append(" 结束时间: \n")
+ .append(" 2020-3-16 00:00:00\n")
+ .append("
\n").append("
\n")
+ .append("
\n").append(" 持续时长: \n")
+ .append(" 2.7h\n").append("
\n")
+ .append("
\n").append(" \n").append("
\n").append("
\n")
+ .append("\n").append("").toString();
+
+ return str;
+
+ }
+
+}
diff --git a/quick-mail/src/main/resources/application.properties b/quick-mail/src/main/resources/application.properties
new file mode 100644
index 00000000..62c60de8
--- /dev/null
+++ b/quick-mail/src/main/resources/application.properties
@@ -0,0 +1,20 @@
+spring.mail.host=smtp.qq.com
+#spring.mail.host=smtp.gmail.com
+spring.mail.username=772704457@qq.com
+spring.mail.password=xxxxxxxxx授权码
+
+# Other properties
+spring.mail.protocol=smtp
+spring.mail.properties.mail.smtp.auth=true
+spring.mail.properties.mail.smtp.connectiontimeout=5000
+spring.mail.properties.mail.smtp.timeout=5000
+spring.mail.properties.mail.smtp.writetimeout=5000
+spring.mail.default-encoding=UTF-8
+
+# TLS , port 587
+spring.mail.properties.mail.smtp.starttls.enable=true
+spring.mail.properties.mail.smtp.starttls.required=true
+
+# SSL, post 465
+#spring.mail.properties.mail.smtp.socketFactory.port = 465
+#spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
\ No newline at end of file
diff --git a/quick-mail/src/main/resources/bang.jpeg b/quick-mail/src/main/resources/bang.jpeg
new file mode 100644
index 00000000..44739870
Binary files /dev/null and b/quick-mail/src/main/resources/bang.jpeg differ
diff --git a/quick-mail/src/main/resources/templates/wel.html b/quick-mail/src/main/resources/templates/wel.html
new file mode 100644
index 00000000..36188256
--- /dev/null
+++ b/quick-mail/src/main/resources/templates/wel.html
@@ -0,0 +1,13 @@
+
+
+
+
+ Email
+
+
+
+Craig Walls says...
+Hello Boot!
+Hello Boot!
+
+
\ No newline at end of file
diff --git a/quick-mail/src/test/java/service/SendEmailServiceTest.java b/quick-mail/src/test/java/service/SendEmailServiceTest.java
new file mode 100644
index 00000000..6c5b0798
--- /dev/null
+++ b/quick-mail/src/test/java/service/SendEmailServiceTest.java
@@ -0,0 +1,57 @@
+package service;
+
+import com.EmailApplication;
+import com.quick.mail.service.SendEmailService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.thymeleaf.TemplateEngine;
+import org.thymeleaf.context.Context;
+
+import javax.annotation.Resource;
+import javax.mail.MessagingException;
+import java.io.FileNotFoundException;
+
+/**
+ *
+ * @author wangxc
+ * @date: 2020/5/6 下午9:52
+ *
+ */
+@SpringBootTest(classes = EmailApplication.class)
+@RunWith(SpringJUnit4ClassRunner.class)
+public class SendEmailServiceTest {
+
+ @Resource
+ private SendEmailService sendEmailService;
+
+
+
+ @Test
+ public void testSendTxtEmail() {
+ sendEmailService.sendEmail();
+ }
+
+ @Test
+ public void testSendImageEmail() throws MessagingException, FileNotFoundException {
+ sendEmailService.sendImageEmail();
+ }
+
+ @Test
+ public void testSendHtmlEmail() throws MessagingException {
+ sendEmailService.sendHtmlEmail();
+ }
+
+ @Test
+ public void testSendAttachmentMail() throws FileNotFoundException, MessagingException {
+ sendEmailService.sendAttachmentMail();
+ }
+
+ @Test
+ public void testTemplateEmail() throws FileNotFoundException, MessagingException {
+ sendEmailService.sendTemplateEmail();
+
+ }
+}
diff --git a/quick-maven-plugin/pom.xml b/quick-maven-plugin/pom.xml
new file mode 100644
index 00000000..67caae74
--- /dev/null
+++ b/quick-maven-plugin/pom.xml
@@ -0,0 +1,61 @@
+
+
+
+ quick-platform
+ com.quick
+ 1.0-SNAPSHOT
+ ../quick-platform/pom.xml
+
+
+ 4.0.0
+
+ quick-maven-plugin
+ 1.0-SNAPSHOT
+ maven-plugin
+
+
+ 8
+ 8
+ UTF-8
+
+
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 3.0
+
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ provided
+ 3.4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/quick-maven-plugin/src/main/java/com/quick/plugin/TimerPlugin.java b/quick-maven-plugin/src/main/java/com/quick/plugin/TimerPlugin.java
new file mode 100644
index 00000000..45a454c7
--- /dev/null
+++ b/quick-maven-plugin/src/main/java/com/quick/plugin/TimerPlugin.java
@@ -0,0 +1,30 @@
+package com.quick.plugin;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+
+@Mojo(name = "TimerPlugin")
+public class TimerPlugin extends AbstractMojo {
+
+ @Parameter(property = "timer.username",defaultValue = "vector")
+ private String userName;
+
+ @Parameter(property = "timer.status",defaultValue = "nice")
+ private String status;
+
+
+
+ @Override
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ String currentTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+ getLog().info("timer plugin is running,current time is " + currentTime);
+ getLog().info(String.format("hi %s ! Now you are %s",userName,status));
+ }
+}
diff --git a/quick-method-evaluate/.DS_Store b/quick-method-evaluate/.DS_Store
new file mode 100644
index 00000000..c1294c47
Binary files /dev/null and b/quick-method-evaluate/.DS_Store differ
diff --git a/quick-method-evaluate/pom.xml b/quick-method-evaluate/pom.xml
new file mode 100644
index 00000000..762a54f6
--- /dev/null
+++ b/quick-method-evaluate/pom.xml
@@ -0,0 +1,53 @@
+
+
+ quick-method-evaluate
+ com.quick
+ 1.0-SNAPSHOT
+ 4.0.0
+
+
+
+ com.github.houbb
+ junitperf
+ 2.0.0
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+
+
+ com.github.houbb
+ log-integration
+
+
+ org.freemarker
+ freemarker
+
+
+ com.google.guava
+ guava
+
+
+ org.apache.commons
+ commons-math3
+
+
+ org.apiguardian
+ apiguardian-api
+
+
+ org.opentest4j
+ opentest4j
+
+
+ org.junit.platform
+ junit-platform-commons
+
+
+
+
+
+
+
diff --git a/quick-method-evaluate/src/main/java/com/method/evaluate/SampleUtilsTest.java b/quick-method-evaluate/src/main/java/com/method/evaluate/SampleUtilsTest.java
new file mode 100644
index 00000000..8fcc7a80
--- /dev/null
+++ b/quick-method-evaluate/src/main/java/com/method/evaluate/SampleUtilsTest.java
@@ -0,0 +1,46 @@
+package com.method.evaluate;
+
+import com.github.houbb.junitperf.core.annotation.JunitPerfConfig;
+import com.github.houbb.junitperf.core.report.impl.HtmlReporter;
+
+import java.util.WeakHashMap;
+
+/**
+ *
+ * @author wangxc
+ * @date: 2019-11-16 09:43
+ *
+ */
+public class SampleUtilsTest {
+
+
+ /**
+ * 2个线程运行。
+ * 准备时间:1000ms
+ * 运行时间: 2000ms
+ * @throws InterruptedException if any
+ */
+ @JunitPerfConfig(duration = 2000)
+ public void junitPerfConfigTest() throws InterruptedException {
+ System.out.println("junitPerfConfigTest");
+ Thread.sleep(200);
+ }
+
+ @JunitPerfConfig(warmUp = 1000, duration = 5000, reporter = {HtmlReporter.class})
+ public void print1Test() {
+ Long sum = 0L;
+ for (long i = 0; i < Integer.MAX_VALUE; i++) {
+ sum += i;
+ }
+ System.out.println(sum);
+ }
+
+ @JunitPerfConfig(duration = 5000)
+ public void print2Test() {
+ long sum = 0L;
+ for (long i = 0; i < Integer.MAX_VALUE; i++) {
+ sum += i;
+ }
+ System.out.println(sum);
+ }
+}
diff --git a/quick-modules/README.md b/quick-modules/README.md
new file mode 100644
index 00000000..9732d449
--- /dev/null
+++ b/quick-modules/README.md
@@ -0,0 +1,366 @@
+
+# SpringBoot多模块的开发、发布、引用与部署(Nexus3)
+
+
+>历史上的今天,那是在我国古代的这一天,蒙古人铁木真中年得了一种因脱发导致变成秃头的不治之症,因为之前从为见过此病例,所以便以铁木真的名字来命名此病,也就是现在大家都知道的“老铁没毛病”。
+
+### 为何模块开发
+
+ 先举个栗子,同一张数据表,可能要在多个项目中或功能中使用,所以就有可能在每个模块都要搞一个mybatis去配置。如果一开始规定说这张表一定不可以改字段属性,那么没毛病。但是事实上, 一张表从项目开始到结束,不知道被改了多少遍,所以,你有可能在多个项目中去改mybatis改到吐血!
+在举一个栗子,一个web服务里包含了多个功能模块,比如其中一个功能可能会消耗大量资源和时间,当用户调用这个功能的时候,可能会影响到其他功能的正常使用,这个时候,如果把各个功能模块分出来单独部署,然后通过http请求去调用,至于性能和响应速度,再单独去优化,整个过程会非常的舒服!这也有利于将来的分布式集群(现在的微服务springcloud或dubbo就是模块化编程的最好示例)。
+ 根据当前的业务需求,我需要重构现有的web功能,多模块化,然后单独部署,基本架构示意图如下
+[](https://i.loli.net/2018/08/10/5b6daa8e7e5c9.png)
+
+
+
+### 怎样分模块
+注意:下面配置的步骤是基于IntelliJ IDEA 2016.3.4(64),不保证eclipse能成功。如果你还在使用eclipse,建议你删掉它,使用idea吧
+1、创建maven主项目例如,springbootmodules,并删掉src文件
+2、右键项目分别创建三个module,dao,service1,service2
+3、将之前项目用到的依赖写在主项目的pom里,这里要注意
+4、dao层主要提供实体类,CURD接口和xml映射文件
+5、一定要在service1和service2配置数据库的相关信息,并添加spring的相关配置
+6、编写接口测试
+
+### 相关代码
+父项目pom
+
+本地测试的时候,手残安装了Nexus3,所以使用起来跟Nexus有点不太一样
+
+```xml
+
+
+
+ quick-modules
+ com.quick
+ pom
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+
+ dao
+ service1
+ service2
+ test
+
+
+
+ 1.8
+ 1.3.1
+ 5.1.39
+ junit
+ 2.4.2
+ 1.9.2
+ 1.2
+ 1.4
+ 1.2.7
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 1.5.1.RELEASE
+
+
+
+
+
+
+
+
+ com.quick
+ quick-modules-dao
+ ${project.version}
+
+
+
+ com.quick
+ quick-modules-service1
+ ${project.version}
+
+
+
+ com.quick
+ quick-modules-service2
+ ${project.version}
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ ${mybatis-spring-boot}
+
+
+
+
+ junit
+ junit
+ ${junit.version}
+
+
+ org.apache.commons
+ commons-pool2
+ ${commons-pool2.versoin}
+
+
+ commons-beanutils
+ commons-beanutils
+ ${commons-beanutils.version}
+
+
+
+ commons-logging
+ commons-logging
+ ${commons-logging.version}
+
+
+
+ commons-dbcp
+ commons-dbcp
+ commons-dbcp.version
+
+
+ com.alibaba
+ fastjson
+ ${fastjson.version}
+
+
+
+
+
+
+
+
+
+ nexus
+ Releases
+ http://nexus.wangxc.club:8081/repository/maven-releases
+
+
+ nexus
+ Snapshot
+ http://nexus.wangxc.club:8081/repository/maven-snapshots
+
+
+
+
+
+
+ nexus
+ Nexus Plugin Repository
+ http://nexus.wangxc.club:8081/repository/maven-public/
+
+ true
+
+
+ true
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 2.4
+
+ true
+
+
+
+ attach-sources
+
+ package
+
+ jar-no-fork
+
+
+
+
+
+
+
+```
+dao模块的pom(里面配置了mybatis的逆向功能插件)
+```xml
+
+
+
+ springbootquick
+ com.boot.lean
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ dao
+ jar
+
+
+
+
+
+ src/main/java
+
+ **/*.xml
+
+
+
+ src/main/resources
+
+
+
+
+```
+service1和service2的pom一样
+```xml
+
+
+
+ quick-modules
+ com.quick
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ jar
+ quick-modules-service1
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.quick
+ quick-modules-dao
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ ${mybatis-spring-boot}
+
+
+
+
+ com.alibaba
+ fastjson
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+```
+需要注意的是,service模块里我用的是注解配置,如图所示
+
+
+注意配置文件里的端口号
+
+2018年08月10日23:18:27 已经更新了,上图的配置已经改变,请在github上查看最新代码
+注意service中引入dao模块时候spring对mapper的扫描配置,建议最好加上MapperScan这个注解即使你这个service的包名跟dao里的一样
+```
+@SpringBootApplication
+@MapperScan("com.modules.dao")
+public class Application {
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class);
+ }
+}
+```
+
+具体代码[请点我](https://github.com/vector4wang/spring-boot-quick/tree/master/quick-modules)
+
+### 发布
+
+发布的时候需要在maven里的setting配置下权限,参照官网给的[示例](https://help.sonatype.com/repomanager3/maven-repositories),一步到位
+```
+
+
+
+ nexus
+ admin
+ admin123
+
+
+
+
+
+ nexus
+ *
+ http://localhost:8081/repository/maven-public/
+
+
+
+
+ nexus
+
+
+
+
+ central
+ http://central
+ true
+ true
+
+
+
+
+ central
+ http://central
+ true
+ true
+
+
+
+
+
+
+ nexus
+
+
+```
+对于dao模块一定要先deploy到私服上才行,在dao根目录执行
+`mvn deploy` 即可
+为了展示如何引用,我创建了单独的test模块,供大家测试使用
+你可以直接运行,也可以打包成jar包运行
+
+
+### 打包测试
+在父项目下执行maven命令
+```bash
+mvn package
+```
+service1和service2目录下分别会产生target文件,里面包含可执行jar包,分别执行
+```bash
+java -jar service1-1.0-SNAPSHOT
+java -jar service2-1.0-SNAPSHOT
+```
+如果一切顺利的话,你可以得出下面的操作结果
+
+
+
+注意端口号哦
+
+有什么问题,自行解决,然后你会发现,跨过这个坑,还有无数个坑在等你~在等你~
\ No newline at end of file
diff --git a/quick-modules/dao/pom.xml b/quick-modules/dao/pom.xml
index 8f73329c..d6342281 100644
--- a/quick-modules/dao/pom.xml
+++ b/quick-modules/dao/pom.xml
@@ -18,7 +18,10 @@
org.mybatis.spring.boot
mybatis-spring-boot-starter
- ${mybatis-spring-boot}
+
+
+ mysql
+ mysql-connector-java