├── hello ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ └── banner.txt │ │ └── java │ │ │ └── com │ │ │ └── jetictors │ │ │ └── example │ │ │ └── hello │ │ │ ├── HelloApplication.java │ │ │ └── controller │ │ │ └── HelloController.java │ └── test │ │ └── java │ │ └── com │ │ └── jetictors │ │ └── example │ │ └── hello │ │ └── HelloApplicationTests.java ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── .gitignore ├── pom.xml └── mvnw.cmd ├── log ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ ├── banner.txt │ │ │ └── logback.xml │ │ └── java │ │ │ └── com │ │ │ └── jetictors │ │ │ └── example │ │ │ └── log │ │ │ ├── controller │ │ │ ├── LogController.java │ │ │ └── HelloController.java │ │ │ ├── LogApplication.java │ │ │ └── config │ │ │ └── log │ │ │ └── LogConfig.java │ └── test │ │ └── java │ │ └── com │ │ └── jetictors │ │ └── example │ │ └── log │ │ └── LogApplicationTests.java ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── .gitignore ├── pom.xml └── mvnw.cmd ├── README.md ├── properties ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.yml │ │ │ ├── META-INF │ │ │ │ └── additional-spring-configuration-metadata.json │ │ │ ├── application-dev.yml │ │ │ ├── application-prod.yml │ │ │ ├── application-test.yml │ │ │ └── banner.txt │ │ └── java │ │ │ └── com │ │ │ └── jetictors │ │ │ └── example │ │ │ └── properties │ │ │ ├── PropertiesApplication.java │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ └── property │ │ │ └── UserProperty.java │ └── test │ │ └── java │ │ └── com │ │ └── jetictors │ │ └── example │ │ └── properties │ │ └── PropertiesApplicationTests.java ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── .gitignore └── pom.xml ├── jpa ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.yml │ │ │ └── banner.txt │ │ └── java │ │ │ └── com │ │ │ └── jetictors │ │ │ └── example │ │ │ └── jpa │ │ │ ├── JpaApplication.java │ │ │ ├── dao │ │ │ └── UserDao.java │ │ │ ├── service │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ └── UserServiceImpl.java │ │ │ ├── model │ │ │ ├── BaseModel.java │ │ │ └── User.java │ │ │ └── controller │ │ │ └── UserController.java │ └── test │ │ └── java │ │ └── com │ │ └── jetictors │ │ └── example │ │ └── jpa │ │ └── JpaApplicationTests.java ├── .gitignore ├── pom.xml └── mvnw.cmd ├── mybatis ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ ├── banner.txt │ │ │ └── mapper │ │ │ │ └── UserMapper.xml │ │ └── java │ │ │ └── com │ │ │ └── jetictors │ │ │ └── example │ │ │ └── mybatis │ │ │ ├── MybatisApplication.java │ │ │ ├── service │ │ │ ├── UserService.java │ │ │ ├── CityService.java │ │ │ └── impl │ │ │ │ ├── UserServiceImpl.java │ │ │ │ └── CityServiceImpl.java │ │ │ ├── dao │ │ │ ├── UserDao.java │ │ │ └── CityDao.java │ │ │ ├── controller │ │ │ ├── UserController.java │ │ │ └── CityController.java │ │ │ └── model │ │ │ ├── City.java │ │ │ └── User.java │ └── test │ │ └── java │ │ └── com │ │ └── jetictors │ │ └── example │ │ └── mybatis │ │ └── MybatisApplicationTests.java ├── .gitignore ├── pom.xml └── demo.sql ├── swagger ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── banner.txt │ │ │ ├── application.yml │ │ │ └── mapper │ │ │ │ ├── CityMapper.xml │ │ │ │ └── UserMapper.xml │ │ └── java │ │ │ └── com │ │ │ └── jetictors │ │ │ └── example │ │ │ └── swagger │ │ │ ├── dao │ │ │ ├── CityDao.java │ │ │ └── UserDao.java │ │ │ ├── service │ │ │ ├── CityService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ ├── CityServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ ├── SwaggerApplication.java │ │ │ ├── model │ │ │ ├── ResultBean.java │ │ │ ├── City.java │ │ │ └── User.java │ │ │ ├── controller │ │ │ ├── CityController.java │ │ │ └── UserController.java │ │ │ ├── config │ │ │ └── SwaggerConfig.java │ │ │ └── property │ │ │ └── SwaggerProperty.java │ └── test │ │ └── java │ │ └── com │ │ └── jetictors │ │ └── example │ │ └── swagger │ │ └── SwaggerApplicationTests.java ├── .gitignore └── pom.xml ├── free-marker ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ ├── web │ │ │ │ ├── index.ftl │ │ │ │ ├── userInfo.ftl │ │ │ │ └── userList.ftl │ │ │ ├── banner.txt │ │ │ └── mapper │ │ │ │ └── UserMapper.xml │ │ └── java │ │ │ └── com │ │ │ └── jetictors │ │ │ └── example │ │ │ └── freemarker │ │ │ ├── FreeMarkerApplication.java │ │ │ ├── service │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ └── UserServiceImpl.java │ │ │ ├── dao │ │ │ └── UserDao.java │ │ │ ├── model │ │ │ ├── BaseModel.java │ │ │ └── User.java │ │ │ └── controller │ │ │ └── UserController.java │ └── test │ │ └── java │ │ └── com │ │ └── jetictors │ │ └── example │ │ └── freemarker │ │ └── FreeMarkerApplicationTests.java ├── .gitignore └── pom.xml ├── mybatis-druid ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.properties │ │ │ ├── banner.txt │ │ │ └── mapper │ │ │ │ ├── master │ │ │ │ └── MasterMapper.xml │ │ │ │ └── cluster │ │ │ │ └── ClusterMapper.xml │ │ └── java │ │ │ └── com │ │ │ └── jetictors │ │ │ └── example │ │ │ └── mybatisdruid │ │ │ ├── config │ │ │ ├── CommonConfig.java │ │ │ ├── ClusterDataSourceConfig.java │ │ │ └── MasterDataSourceConfig.java │ │ │ ├── MybatisDruidApplication.java │ │ │ ├── service │ │ │ ├── MasterService.java │ │ │ ├── DruidService.java │ │ │ ├── ClusterService.java │ │ │ └── impl │ │ │ │ ├── MasterServiceImpl.java │ │ │ │ ├── ClusterServiceImpl.java │ │ │ │ └── DruidServiceImpl.java │ │ │ ├── dao │ │ │ ├── master │ │ │ │ └── MasterDao.java │ │ │ └── cluster │ │ │ │ └── ClusterDao.java │ │ │ ├── model │ │ │ ├── DruidEntity.java │ │ │ ├── MasterEntity.java │ │ │ └── ClusterEntity.java │ │ │ └── controller │ │ │ ├── DruidController.java │ │ │ ├── MasterController.java │ │ │ └── ClusterController.java │ └── test │ │ └── java │ │ └── com │ │ └── jetictors │ │ └── example │ │ └── mybatisdruid │ │ └── MybatisDruidApplicationTests.java ├── .gitignore ├── master.sql ├── cluster.sql └── pom.xml └── .gitignore /hello/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /log/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # spring-boot-learn 2 | 一步一步学习spring-boot, 争取转型后端开发 3 | -------------------------------------------------------------------------------- /properties/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | profiles: 3 | active: prod -------------------------------------------------------------------------------- /jpa/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/jpa/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /log/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/log/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /hello/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/hello/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /jpa/src/main/resources/application.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/jpa/src/main/resources/application.yml -------------------------------------------------------------------------------- /mybatis/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/mybatis/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /swagger/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/swagger/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /free-marker/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/free-marker/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /properties/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/properties/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /mybatis-druid/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/mybatis-druid/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /hello/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /jpa/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /log/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /mybatis/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/mybatis/src/main/resources/application.properties -------------------------------------------------------------------------------- /mybatis/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /properties/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /swagger/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /free-marker/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /free-marker/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/free-marker/src/main/resources/application.properties -------------------------------------------------------------------------------- /mybatis-druid/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jetictors/spring-boot-learn/HEAD/mybatis-druid/src/main/resources/application.properties -------------------------------------------------------------------------------- /free-marker/src/main/resources/web/index.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | welcome 6 | 7 | 8 | 9 | this is Index Page 10 | 11 | 12 | -------------------------------------------------------------------------------- /properties/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "name": "user.userId ", 5 | "type": "java.lang.String", 6 | "description": "Description for user.userId ." 7 | } 8 | ] } -------------------------------------------------------------------------------- /properties/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | # 配置端口 2 | server: 3 | port: 8081 4 | 5 | # 自定义属性 6 | explain : spring boot启动成功了,我是dev分支 7 | 8 | # 配置user对象属性(请看UserProperty) 9 | user: 10 | userId : 1 11 | userName : dev 12 | pwd : 123456 13 | nickName : dev-app 14 | age : 21 15 | sex : 0 16 | -------------------------------------------------------------------------------- /properties/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | # 配置端口 2 | server: 3 | port: 8082 4 | 5 | # 自定义属性 6 | explain : spring boot启动成功了,我是prod分支 7 | 8 | # 配置user对象属性(请看UserProperty) 9 | user: 10 | userId : 2 11 | userName : prod 12 | pwd : 123456 13 | nickName : prod-app 14 | age : 20 15 | sex : 1 16 | -------------------------------------------------------------------------------- /properties/src/main/resources/application-test.yml: -------------------------------------------------------------------------------- 1 | # 配置端口 2 | server: 3 | port: 8083 4 | 5 | # 自定义属性 6 | explain : spring boot启动成功了,我是test分支 7 | 8 | # 配置user对象属性(请看UserProperty) 9 | user: 10 | userId : 3 11 | userName : test 12 | pwd : 123456 13 | nickName : test-app 14 | age : 23 15 | sex : 0 16 | -------------------------------------------------------------------------------- /jpa/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | Spring Boot 学习案例( JPA ) 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /free-marker/src/main/resources/web/userInfo.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UserInfo 6 | 7 | 8 | 9 | this is UserInfo Page 10 |
11 |

12 | UserInfo : ${user} 13 |

14 | 15 | 16 | -------------------------------------------------------------------------------- /hello/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | Spring Boot 学习案例(Hello World) 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /mybatis/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | Spring Boot 学习案例(MyBatis) 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /properties/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | Spring Boot 学习案例(配置文件详解) 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /swagger/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | Spring Boot 学习案例(Swagger2集成) 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /log/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | Spring Boot 学习案例(Logger日志) 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /mybatis-druid/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | Spring Boot 学习案例(MyBatis + Druid) 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /free-marker/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ==================================================================================================================== 2 | 3 | Spring Boot 学习案例(MyBatis + FreeMarker) 4 | 5 | ==================================================================================================================== -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.nar 17 | *.ear 18 | *.zip 19 | *.tar.gz 20 | *.rar 21 | 22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 23 | hs_err_pid* 24 | -------------------------------------------------------------------------------- /jpa/src/main/java/com/jetictors/example/jpa/JpaApplication.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.jpa; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class JpaApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(JpaApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /hello/src/main/java/com/jetictors/example/hello/HelloApplication.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.hello; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class HelloApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(HelloApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /properties/src/main/java/com/jetictors/example/properties/PropertiesApplication.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.properties; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class PropertiesApplication{ 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(PropertiesApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jpa/src/test/java/com/jetictors/example/jpa/JpaApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.jpa; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class JpaApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /log/src/test/java/com/jetictors/example/log/LogApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.log; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class LogApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /jpa/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /log/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /hello/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /hello/src/main/java/com/jetictors/example/hello/controller/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.hello.controller; 2 | 3 | import org.springframework.web.bind.annotation.RequestMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | @RestController 7 | @RequestMapping("/test") 8 | public class HelloController { 9 | 10 | @RequestMapping("/hello") 11 | public String sayHello(){ 12 | return "Hello World !"; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /hello/src/test/java/com/jetictors/example/hello/HelloApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.hello; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class HelloApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /mybatis/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /swagger/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /free-marker/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /mybatis-druid/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /properties/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /mybatis/src/test/java/com/jetictors/example/mybatis/MybatisApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class MybatisApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /swagger/src/test/java/com/jetictors/example/swagger/SwaggerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class SwaggerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /free-marker/src/test/java/com/jetictors/example/freemarker/FreeMarkerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.freemarker; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class FreeMarkerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /properties/src/test/java/com/jetictors/example/properties/PropertiesApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.properties; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class PropertiesApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /mybatis-druid/src/test/java/com/jetictors/example/mybatisdruid/MybatisDruidApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class MybatisDruidApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /log/src/main/java/com/jetictors/example/log/controller/LogController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.log.controller; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @Slf4j 8 | @RestController 9 | @RequestMapping("/test") 10 | public class LogController { 11 | 12 | @RequestMapping("/log") 13 | public String testLog(){ 14 | log.info("Log控制类执行了"); 15 | return "日志已打印 请查看控制台 !"; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/MybatisApplication.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("com.jetictors.example.mybatis.dao") 9 | public class MybatisApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(MybatisApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /log/src/main/java/com/jetictors/example/log/LogApplication.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.log; 2 | 3 | import com.jetictors.example.log.config.log.LogConfig; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | public class LogApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(LogApplication.class, args); 12 | LogConfig.getInstance().getLogger(LogApplication.class).info("服务器启动成功"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /free-marker/src/main/java/com/jetictors/example/freemarker/FreeMarkerApplication.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.freemarker; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | @MapperScan("com.jetictors.example.freemarker.dao") 9 | public class FreeMarkerApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(FreeMarkerApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /log/src/main/java/com/jetictors/example/log/controller/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.log.controller; 2 | 3 | import com.jetictors.example.log.config.log.LogConfig; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | @RequestMapping("/test") 9 | public class HelloController { 10 | 11 | @RequestMapping("/hello") 12 | public String sayHello(){ 13 | LogConfig.getInstance().getLogger(this.getClass()).info("Hello控制类执行了"); 14 | return "Hello World !"; 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/config/CommonConfig.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.config; 2 | 3 | import com.alibaba.druid.pool.DruidDataSource; 4 | 5 | import javax.sql.DataSource; 6 | 7 | public class CommonConfig{ 8 | 9 | DataSource getDataSource(String url, String driverClass, String user, String pwd){ 10 | DruidDataSource dataSource = new DruidDataSource(); 11 | dataSource.setDriverClassName(driverClass); 12 | dataSource.setUrl(url); 13 | dataSource.setUsername(user); 14 | dataSource.setPassword(pwd); 15 | return dataSource; 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/MybatisDruidApplication.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.mybatis.spring.annotation.MapperScan; 5 | import org.springframework.boot.SpringApplication; 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; 7 | 8 | @Slf4j 9 | @SpringBootApplication 10 | @MapperScan("com.jetictors.example.mybatisdruid.dao") 11 | public class MybatisDruidApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(MybatisDruidApplication.class, args); 15 | log.info("服务器启动成功"); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.service; 2 | 3 | import com.jetictors.example.mybatis.model.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 用户业务类 9 | * Author : Jetictors 10 | * Time : 2019/8/6 12:31 11 | * Email : zhengxcfutures@gmail.com 12 | * Version : v-1.0.1 13 | */ 14 | public interface UserService { 15 | 16 | /** 17 | * 根据id获取对象 18 | * @param userId 用户id 19 | * @return 20 | */ 21 | User getUserById(String userId); 22 | 23 | /** 24 | * 获取全部用户对象 25 | * @return 26 | */ 27 | List getUserList(); 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/service/CityService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.service; 2 | 3 | import com.jetictors.example.mybatis.model.City; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 城市业务类 9 | * Author : Jetictors 10 | * Time : 2019/8/6 15:20 11 | * Email : zhengxcfutures@gmail.com 12 | * Version : v-1.0.1 13 | */ 14 | public interface CityService { 15 | 16 | /** 17 | * 根据城市名称获取城市数据 18 | * @param cityName 城市名称 19 | * @return 20 | */ 21 | City getCityByName(String cityName); 22 | 23 | /** 24 | * 获取城市列表数据 25 | * @return 26 | */ 27 | List getCityList(); 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/service/MasterService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.service; 2 | 3 | import com.jetictors.example.mybatisdruid.model.MasterEntity; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 主数据库业务类 10 | * Author : Jetictors 11 | * Time : 2019/8/6 16:45 12 | * Email : zhengxcfutures@gmail.com 13 | * Version : v-1.0.1 14 | */ 15 | public interface MasterService { 16 | 17 | /** 18 | *根据masterId获取master表的数据 19 | * @param masterId 主id 20 | * @return 21 | */ 22 | MasterEntity getMasterById(@Param("masterId") int masterId); 23 | 24 | /** 25 | * 获取全部数据 26 | */ 27 | List getMasterList(); 28 | 29 | } 30 | 31 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/service/DruidService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.service; 2 | 3 | import com.jetictors.example.mybatisdruid.model.DruidEntity; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 连接两个数据路查询的业务类 10 | * Author : Jetictors 11 | * Time : 2019/8/6 17:02 12 | * Email : zhengxcfutures@gmail.com 13 | * Version : v-1.0.1 14 | */ 15 | public interface DruidService { 16 | 17 | /** 18 | * 根据masterId获取连接的一条数据 19 | * @param masterId 20 | * @return 21 | */ 22 | DruidEntity getDruidById(@Param("masterId") int masterId); 23 | 24 | 25 | /** 26 | * 获取全部数据 27 | */ 28 | List getDruidList(); 29 | 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/dao/master/MasterDao.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.dao.master; 2 | 3 | import com.jetictors.example.mybatisdruid.model.MasterEntity; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 主数据库dao类 10 | * Author : Jetictors 11 | * Time : 2019/8/6 16:30 12 | * Email : zhengxcfutures@gmail.com 13 | * Version : v-1.0.1 14 | */ 15 | public interface MasterDao { 16 | 17 | /** 18 | * 根据id获取主数据库中表master得一条数据 19 | * @param masterId id 20 | * @return 21 | */ 22 | MasterEntity getMasterById(@Param("masterId") int masterId); 23 | 24 | /** 25 | * 获取从数据库中表cluster数据 26 | * @return 27 | */ 28 | List getMasterList(); 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.dao; 2 | 3 | import com.jetictors.example.mybatis.model.User; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.apache.ibatis.annotations.Param; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Desc : 用户dao类 11 | * Author : Jetictors 12 | * Time : 2019/8/6 14:15 13 | * Email : zhengxcfutures@gmail.com 14 | * Version : v-1.0.1 15 | */ 16 | @Mapper 17 | public interface UserDao { 18 | 19 | /** 20 | * 根据id获取用户 21 | * 其中@Param注解中的参数是数据库表中对应的字段 22 | * @param userId 用户id 23 | * @return 24 | */ 25 | User getUserById(@Param("userId") String userId); 26 | 27 | /** 28 | * 获取全部用户 29 | * @return 30 | */ 31 | List getUserList(); 32 | 33 | } 34 | 35 | -------------------------------------------------------------------------------- /swagger/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | # 服务 2 | server: 3 | port: 8080 4 | 5 | # 数据库配置 6 | spring: 7 | datasource: 8 | url: jdbc:mysql://localhost:3306/demo?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8 9 | username: root 10 | password: 123456 11 | driver-class-name: com.mysql.cj.jdbc.Driver 12 | 13 | # Mybatis 配置 14 | mybatis: 15 | typeAliasesPackage: com.jetictors.example.swagger.model 16 | mapper-locations: classpath:mapper/*.xml 17 | 18 | # swagger属性配置 19 | swagger: 20 | title: API示例文档 21 | desc: 基于springBoot编写的RESful-API 22 | version: 1.0.1 23 | termsOfServiceUrl: https://github.com/Jetictors/spring-boot-learn 24 | license: Apache 2.0 25 | licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.html 26 | basePackage: com.jetictors.example.swagger.controller 27 | groupName: 默认API示例分组 28 | contactName: Jetictors 29 | contactUrl: https://github.com/Jetictors 30 | contactEmail: zhengxcfutures@gmail.com -------------------------------------------------------------------------------- /jpa/src/main/java/com/jetictors/example/jpa/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.jpa.dao; 2 | 3 | import com.jetictors.example.jpa.model.User; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.Query; 6 | import org.springframework.data.repository.query.Param; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * Desc : 用户dao类 11 | * Author : Jetictors 12 | * Time : 2019/8/13 15:29 13 | * Email : zhengxcfutures@gmail.com 14 | * Version : v-1.0.1 15 | */ 16 | @Repository 17 | public interface UserDao extends JpaRepository { 18 | 19 | /** 20 | * 根据用户名获取用户对象 21 | * @param userName 22 | * @return 23 | */ 24 | @Query(nativeQuery = true, value = "select * from tb_user where user_name= :user_name") 25 | User getUserByName(@Param("user_name") String userName); 26 | 27 | } 28 | 29 | -------------------------------------------------------------------------------- /free-marker/src/main/resources/web/userList.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UserList 6 | 7 | 8 | 9 | this is UserList Page 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | <#list userList as user> 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
userIduserNamepwdnickNameagesex
${user.userId}${user.userName}${user.pwd}${user.nickName}${user.age}${user.sex}
31 | 32 | 33 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/resources/mapper/master/MasterMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/dao/CityDao.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.dao; 2 | 3 | import com.jetictors.example.swagger.model.City; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 城市dao类 9 | * Author : Jetictors 10 | * Time : 2019/8/14 10:37 11 | * Email : zhengxcfutures@gmail.com 12 | * Version : v-1.0.1 13 | */ 14 | public interface CityDao { 15 | 16 | /** 17 | * 根据城市名称获取城市数据 18 | * @param cityName 城市名称 19 | * @return 20 | */ 21 | City getCityByName(String cityName); 22 | 23 | /** 24 | * 获取全部城市列表 25 | * @return 26 | */ 27 | List getCityList(); 28 | 29 | /** 30 | * 添加城市 31 | * @return 32 | */ 33 | int addCity(City city); 34 | 35 | /** 36 | * 根据城市名称删除城市 37 | * @param cityName 城市名称 38 | * @return 39 | */ 40 | int deleteCityByName(String cityName); 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/service/CityService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.service; 2 | 3 | import com.jetictors.example.swagger.model.City; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 城市业务类 9 | * Author : Jetictors 10 | * Time : 2019/8/14 10:34 11 | * Email : zhengxcfutures@gmail.com 12 | * Version : v-1.0.1 13 | */ 14 | public interface CityService { 15 | 16 | /** 17 | * 根据城市名称获取城市数据 18 | * @param cityName 城市名称 19 | * @return 20 | */ 21 | City getCityByName(String cityName); 22 | 23 | /** 24 | * 获取全部城市列表 25 | * @return 26 | */ 27 | List getCityList(); 28 | 29 | /** 30 | * 添加城市 31 | * @return 32 | */ 33 | int addCity(City city); 34 | 35 | /** 36 | * 根据城市名称删除城市 37 | * @param cityName 城市名称 38 | * @return 39 | */ 40 | int deleteCityByName(String cityName); 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /mybatis/src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 20 | 21 | -------------------------------------------------------------------------------- /log/src/main/java/com/jetictors/example/log/config/log/LogConfig.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.log.config.log; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | /** 7 | * Desc : logger配置类 8 | * Author : Jetictors 9 | * Time : 2019/8/6 11:49 10 | * Email : zhengxcfutures@gmail.com 11 | * Version : v-1.0.1 12 | */ 13 | public class LogConfig { 14 | 15 | private static LogConfig sInstance; 16 | 17 | public static LogConfig getInstance(){ 18 | if (null == sInstance){ 19 | synchronized (LogConfig.class){ 20 | if (null == sInstance){ 21 | sInstance = new LogConfig(); 22 | } 23 | } 24 | } 25 | return sInstance; 26 | } 27 | 28 | public Logger getLogger(String name){ 29 | return LoggerFactory.getLogger(name); 30 | } 31 | 32 | public Logger getLogger(Class clazz){ 33 | return LoggerFactory.getLogger(clazz); 34 | } 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/service/ClusterService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.service; 2 | 3 | import com.jetictors.example.mybatisdruid.model.ClusterEntity; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 从数据库业务类 10 | * Author : Jetictors 11 | * Time : 2019/8/6 16:46 12 | * Email : zhengxcfutures@gmail.com 13 | * Version : v-1.0.1 14 | */ 15 | public interface ClusterService { 16 | 17 | /** 18 | * 根据masterId获取cluster表的数据 19 | * @param masterId 主id 20 | * @return 21 | */ 22 | List getClusterByMasterId(@Param("masterId") int masterId); 23 | 24 | 25 | /** 26 | * 根据clusterId获取cluster表的一条数据 27 | * @param clusterId 从id 28 | * @return 29 | */ 30 | ClusterEntity getClusterByClusterId(@Param("clusterId") int clusterId); 31 | 32 | /** 33 | * 获取全部数据 34 | */ 35 | List getClusterList(); 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.service.impl; 2 | 3 | import com.jetictors.example.mybatis.dao.UserDao; 4 | import com.jetictors.example.mybatis.model.User; 5 | import com.jetictors.example.mybatis.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 用户业务实现类 13 | * Author : Jetictors 14 | * Time : 2019/8/6 12:32 15 | * Email : zhengxcfutures@gmail.com 16 | * Version : v-1.0.1 17 | */ 18 | 19 | @Service 20 | public class UserServiceImpl implements UserService { 21 | 22 | @Autowired 23 | private UserDao userDao; 24 | 25 | @Override 26 | public User getUserById(String userId) { 27 | return userDao.getUserById(userId); 28 | } 29 | 30 | @Override 31 | public List getUserList() { 32 | return userDao.getUserList(); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.dao; 2 | 3 | import com.jetictors.example.swagger.model.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 用户dao类 9 | * Author : Jetictors 10 | * Time : 2019/8/14 10:37 11 | * Email : zhengxcfutures@gmail.com 12 | * Version : v-1.0.1 13 | */ 14 | public interface UserDao { 15 | 16 | /** 17 | * 根据用户id获取用户数据 18 | * @param userId 用户id 19 | * @return 20 | */ 21 | User getUserById(long userId); 22 | 23 | /** 24 | * 获取全部用户列表 25 | * @return 26 | */ 27 | List getUserList(); 28 | 29 | /** 30 | * 添加用户 31 | * @return 32 | */ 33 | int addUser(User user); 34 | 35 | /** 36 | * 根据用户id删除用户 37 | * @param userId 用户id 38 | * @return 39 | */ 40 | int deleteUserById(long userId); 41 | 42 | /** 43 | * 更新用户 44 | * @return 45 | */ 46 | int updateUser(User user); 47 | 48 | } 49 | 50 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/service/impl/CityServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.service.impl; 2 | 3 | import com.jetictors.example.mybatis.dao.CityDao; 4 | import com.jetictors.example.mybatis.model.City; 5 | import com.jetictors.example.mybatis.service.CityService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 城市业务实现类 13 | * Author : Jetictors 14 | * Time : 2019/8/6 15:24 15 | * Email : zhengxcfutures@gmail.com 16 | * Version : v-1.0.1 17 | */ 18 | 19 | @Service 20 | public class CityServiceImpl implements CityService { 21 | 22 | @Autowired 23 | private CityDao cityDao; 24 | 25 | @Override 26 | public City getCityByName(String cityName) { 27 | return cityDao.getCityByName(cityName); 28 | } 29 | 30 | @Override 31 | public List getCityList() { 32 | return cityDao.getCityList(); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.service; 2 | 3 | import com.jetictors.example.swagger.model.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 用户业务类 9 | * Author : Jetictors 10 | * Time : 2019/8/14 10:34 11 | * Email : zhengxcfutures@gmail.com 12 | * Version : v-1.0.1 13 | */ 14 | public interface UserService { 15 | 16 | /** 17 | * 根据用户id获取用户数据 18 | * @param userId 用户id 19 | * @return 20 | */ 21 | User getUserById(long userId); 22 | 23 | /** 24 | * 获取全部用户列表 25 | * @return 26 | */ 27 | List getUserList(); 28 | 29 | /** 30 | * 添加用户 31 | * @return 32 | */ 33 | int addUser(User user); 34 | 35 | /** 36 | * 根据用户id删除用户 37 | * @param userId 用户id 38 | * @return 39 | */ 40 | int deleteUserById(long userId); 41 | 42 | /** 43 | * 更新用户 44 | * @return 45 | */ 46 | int updateUser(User user); 47 | 48 | } 49 | 50 | -------------------------------------------------------------------------------- /free-marker/src/main/java/com/jetictors/example/freemarker/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.freemarker.service; 2 | 3 | import com.jetictors.example.freemarker.model.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 用户业务类 9 | * Author : Jetictors 10 | * Time : 2019/8/7 11:39 11 | * Email : zhengxcfutures@gmail.com 12 | * Version : v-1.0.1 13 | */ 14 | public interface UserService { 15 | 16 | /** 17 | * 根据用户id获取用户数据 18 | * @param userId 用户id 19 | * @return 20 | */ 21 | User getUserById(String userId); 22 | 23 | /** 24 | * 获取全部用户列表 25 | * @return 26 | */ 27 | List getUserList(); 28 | 29 | /** 30 | * 添加用户 31 | * @return 32 | */ 33 | int addUser(User user); 34 | 35 | /** 36 | * 根据用户id删除用户 37 | * @param userId 用户id 38 | * @return 39 | */ 40 | int deleteUserById(String userId); 41 | 42 | /** 43 | * 更新用户 44 | * @return 45 | */ 46 | int updateUser(User user); 47 | 48 | } 49 | 50 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/dao/cluster/ClusterDao.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.dao.cluster; 2 | 3 | import com.jetictors.example.mybatisdruid.model.ClusterEntity; 4 | import org.apache.ibatis.annotations.Param; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 从数据库dao类 10 | * Author : Jetictors 11 | * Time : 2019/8/6 16:30 12 | * Email : zhengxcfutures@gmail.com 13 | * Version : v-1.0.1 14 | */ 15 | public interface ClusterDao { 16 | 17 | /** 18 | * 根据clusterId获取从数据库中表cluster得一条数据 19 | * @param clusterId 从id 20 | * @return 21 | */ 22 | ClusterEntity getClusterByClusterId(@Param("clusterId") int clusterId); 23 | 24 | /** 25 | * 根据masterId获取从数据库中表cluster数据 26 | * @param masterId 主id 27 | * @return 28 | */ 29 | List getClusterByMasterId(@Param("masterId") int masterId); 30 | 31 | /** 32 | * 获取从数据库中表cluster数据 33 | * @return 34 | */ 35 | List getClusterList(); 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /free-marker/src/main/java/com/jetictors/example/freemarker/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.freemarker.dao; 2 | 3 | import com.jetictors.example.freemarker.model.User; 4 | import org.apache.ibatis.annotations.Mapper; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 用户dao类 10 | * Author : Jetictors 11 | * Time : 2019/8/7 11:37 12 | * Email : zhengxcfutures@gmail.com 13 | * Version : v-1.0.1 14 | */ 15 | @Mapper 16 | public interface UserDao { 17 | 18 | /** 19 | * 根据用户id获取用户数据 20 | * @param userId 用户id 21 | * @return 22 | */ 23 | User getUserById(String userId); 24 | 25 | /** 26 | * 获取全部用户列表 27 | * @return 28 | */ 29 | List getUserList(); 30 | 31 | /** 32 | * 添加用户 33 | * @return 34 | */ 35 | int addUser(User user); 36 | 37 | /** 38 | * 根据用户id删除用户 39 | * @param userId 用户id 40 | * @return 41 | */ 42 | int deleteUserById(String userId); 43 | 44 | /** 45 | * 更新用户 46 | * @return 47 | */ 48 | int updateUser(User user); 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/service/impl/MasterServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.service.impl; 2 | 3 | import com.jetictors.example.mybatisdruid.dao.master.MasterDao; 4 | import com.jetictors.example.mybatisdruid.model.MasterEntity; 5 | import com.jetictors.example.mybatisdruid.service.MasterService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 业务实现类 13 | * Author : Jetictors 14 | * Time : 2019/8/6 17:19 15 | * Email : zhengxcfutures@gmail.com 16 | * Version : v-1.0.1 17 | */ 18 | 19 | @Service 20 | public class MasterServiceImpl implements MasterService { 21 | 22 | @Autowired 23 | private MasterDao masterDao; 24 | 25 | @Override 26 | public MasterEntity getMasterById(int masterId) { 27 | return masterDao.getMasterById(masterId); 28 | } 29 | 30 | @Override 31 | public List getMasterList() { 32 | return masterDao.getMasterList(); 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /properties/src/main/java/com/jetictors/example/properties/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.properties.controller; 2 | 3 | import com.jetictors.example.properties.property.UserProperty; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * Desc : 控制类 11 | * Author : Jetictors 12 | * Time : 2019/8/8 12:12 13 | * Email : zhengxcfutures@gmail.com 14 | * Version : v-1.0.1 15 | */ 16 | 17 | @RestController 18 | @RequestMapping("/test") 19 | public class UserController{ 20 | 21 | @Value("${explain}") 22 | private String explain; 23 | 24 | @Autowired 25 | private UserProperty userProperty; 26 | 27 | @RequestMapping("/hello") 28 | public String sayHello(){ 29 | return "Hello World !" 30 | + "
" 31 | + explain 32 | + "
" 33 | + userProperty.toString(); 34 | 35 | } 36 | } 37 | 38 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/resources/mapper/cluster/ClusterMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 19 | 20 | 23 | 24 | -------------------------------------------------------------------------------- /jpa/src/main/java/com/jetictors/example/jpa/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.jpa.service; 2 | 3 | import com.jetictors.example.jpa.model.User; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Desc : 用户业务类 9 | * Author : Jetictors 10 | * Time : 2019/8/13 15:34 11 | * Email : zhengxcfutures@gmail.com 12 | * Version : v-1.0.1 13 | */ 14 | public interface UserService { 15 | 16 | /** 17 | * 获取用户列表 18 | * @return 19 | */ 20 | List getAllList(); 21 | 22 | /** 23 | * 根据用户id获取用户信息 24 | * @param userId 用户id 25 | * @return 26 | */ 27 | User getUserById(String userId); 28 | 29 | /** 30 | * 根据用户名获取用户信息 31 | * @param userName 用户名 32 | * @return 33 | */ 34 | User getUserByName(String userName); 35 | 36 | /** 37 | * 添加用户 38 | * @param user 39 | * @return 40 | */ 41 | User addUser(User user); 42 | 43 | /** 44 | * 根据用户id删除用户 45 | * @param userId 用户id 46 | * @return 47 | */ 48 | User deleteUser(String userId); 49 | 50 | /** 51 | * 更新 52 | * @param user 53 | * @return 54 | */ 55 | User updateUser(User user); 56 | 57 | } 58 | 59 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/model/DruidEntity.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.model; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Desc : 连接查询的实体类 7 | * Author : Jetictors 8 | * Time : 2019/8/6 17:03 9 | * Email : zhengxcfutures@gmail.com 10 | * Version : v-1.0.1 11 | */ 12 | public class DruidEntity { 13 | 14 | private MasterEntity master; 15 | 16 | private List list; 17 | 18 | public DruidEntity(MasterEntity master, List list) { 19 | this.master = master; 20 | this.list = list; 21 | } 22 | 23 | public MasterEntity getMaster() { 24 | return master; 25 | } 26 | 27 | public void setMaster(MasterEntity master) { 28 | this.master = master; 29 | } 30 | 31 | public List getList() { 32 | return list; 33 | } 34 | 35 | public void setList(List list) { 36 | this.list = list; 37 | } 38 | 39 | @Override 40 | public String toString() { 41 | return "DruidEntity{" + 42 | "master=" + master + 43 | ", list=" + list + 44 | '}'; 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/SwaggerApplication.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 7 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 9 | import springfox.documentation.spring.web.SpringfoxWebMvcConfiguration; 10 | 11 | @SpringBootApplication 12 | @MapperScan(value = {"com.jetictors.example.swagger.dao"}) 13 | @ConditionalOnClass(SpringfoxWebMvcConfiguration.class) 14 | public class SwaggerApplication implements WebMvcConfigurer { 15 | 16 | @Override 17 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 18 | registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/"); 19 | registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); 20 | } 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SwaggerApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/service/impl/CityServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.service.impl; 2 | 3 | import com.jetictors.example.swagger.dao.CityDao; 4 | import com.jetictors.example.swagger.model.City; 5 | import com.jetictors.example.swagger.service.CityService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 城市业务实现类 13 | * Author : Jetictors 14 | * Time : 2019/8/14 10:35 15 | * Email : zhengxcfutures@gmail.com 16 | * Version : v-1.0.1 17 | */ 18 | @Service 19 | public class CityServiceImpl implements CityService { 20 | 21 | @Autowired 22 | private CityDao cityDao; 23 | 24 | @Override 25 | public City getCityByName(String cityName) { 26 | return cityDao.getCityByName(cityName); 27 | } 28 | 29 | @Override 30 | public List getCityList() { 31 | return cityDao.getCityList(); 32 | } 33 | 34 | @Override 35 | public int addCity(City city) { 36 | return cityDao.addCity(city); 37 | } 38 | 39 | @Override 40 | public int deleteCityByName(String cityName) { 41 | return cityDao.deleteCityByName(cityName); 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /swagger/src/main/resources/mapper/CityMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 20 | 21 | 22 | insert into city (cityId, provinceId, cityName, description) 23 | value (#{cityId}, #{provinceId}, #{cityName}, #{description}) 24 | 25 | 26 | 27 | delete from city where cityName=#{cityName} 28 | 29 | 30 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/service/impl/ClusterServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.service.impl; 2 | 3 | import com.jetictors.example.mybatisdruid.dao.cluster.ClusterDao; 4 | import com.jetictors.example.mybatisdruid.model.ClusterEntity; 5 | import com.jetictors.example.mybatisdruid.service.ClusterService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 业务实现类 13 | * Author : Jetictors 14 | * Time : 2019/8/6 17:19 15 | * Email : zhengxcfutures@gmail.com 16 | * Version : v-1.0.1 17 | */ 18 | 19 | @Service 20 | public class ClusterServiceImpl implements ClusterService { 21 | 22 | @Autowired 23 | private ClusterDao clusterDao; 24 | 25 | @Override 26 | public List getClusterByMasterId(int masterId) { 27 | return clusterDao.getClusterByMasterId(masterId); 28 | } 29 | 30 | @Override 31 | public ClusterEntity getClusterByClusterId(int clusterId) { 32 | return clusterDao.getClusterByClusterId(clusterId); 33 | } 34 | 35 | @Override 36 | public List getClusterList() { 37 | return clusterDao.getClusterList(); 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.service.impl; 2 | 3 | import com.jetictors.example.swagger.dao.UserDao; 4 | import com.jetictors.example.swagger.model.User; 5 | import com.jetictors.example.swagger.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 用户业务实现类 13 | * Author : Jetictors 14 | * Time : 2019/8/14 10:35 15 | * Email : zhengxcfutures@gmail.com 16 | * Version : v-1.0.1 17 | */ 18 | @Service 19 | public class UserServiceImpl implements UserService { 20 | 21 | @Autowired 22 | private UserDao userDao; 23 | 24 | @Override 25 | public User getUserById(long userId) { 26 | return userDao.getUserById(userId); 27 | } 28 | 29 | @Override 30 | public List getUserList() { 31 | return userDao.getUserList(); 32 | } 33 | 34 | @Override 35 | public int addUser(User user) { 36 | return userDao.addUser(user); 37 | } 38 | 39 | @Override 40 | public int deleteUserById(long userId) { 41 | return userDao.deleteUserById(userId); 42 | } 43 | 44 | @Override 45 | public int updateUser(User user) { 46 | return userDao.updateUser(user); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /free-marker/src/main/java/com/jetictors/example/freemarker/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.freemarker.service.impl; 2 | 3 | import com.jetictors.example.freemarker.dao.UserDao; 4 | import com.jetictors.example.freemarker.model.User; 5 | import com.jetictors.example.freemarker.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 用户业务实现类 13 | * Author : Jetictors 14 | * Time : 2019/8/7 11:39 15 | * Email : zhengxcfutures@gmail.com 16 | * Version : v-1.0.1 17 | */ 18 | @Service 19 | public class UserServiceImpl implements UserService { 20 | 21 | @Autowired 22 | private UserDao userDao; 23 | 24 | @Override 25 | public User getUserById(String userId) { 26 | return userDao.getUserById(userId); 27 | } 28 | 29 | @Override 30 | public List getUserList() { 31 | return userDao.getUserList(); 32 | } 33 | 34 | @Override 35 | public int addUser(User user) { 36 | return userDao.addUser(user); 37 | } 38 | 39 | @Override 40 | public int deleteUserById(String userId) { 41 | return userDao.deleteUserById(userId); 42 | } 43 | 44 | @Override 45 | public int updateUser(User user) { 46 | return userDao.updateUser(user); 47 | } 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/controller/DruidController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.controller; 2 | 3 | import com.jetictors.example.mybatisdruid.model.DruidEntity; 4 | import com.jetictors.example.mybatisdruid.service.DruidService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Desc : Druid控制类 12 | * Author : Jetictors 13 | * Time : 2019/8/6 17:25 14 | * Email : zhengxcfutures@gmail.com 15 | * Version : v-1.0.1 16 | */ 17 | 18 | @RestController 19 | @RequestMapping("/test") 20 | public class DruidController { 21 | 22 | @Autowired 23 | private DruidService druidService; 24 | 25 | @RequestMapping(value = "/druid/{masterId}", method = RequestMethod.GET) 26 | public DruidEntity getDruidByIdOne(@PathVariable int masterId){ 27 | return druidService.getDruidById(masterId); 28 | } 29 | 30 | 31 | @RequestMapping(value = "/druid/once", method = RequestMethod.GET) 32 | public DruidEntity getDruidByIdTwo(@RequestParam("masterId") int masterId){ 33 | return druidService.getDruidById(masterId); 34 | } 35 | 36 | @RequestMapping(value = "/druid/all", method = RequestMethod.GET) 37 | public List getDruidList(){ 38 | return druidService.getDruidList(); 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/controller/MasterController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.controller; 2 | 3 | import com.jetictors.example.mybatisdruid.model.MasterEntity; 4 | import com.jetictors.example.mybatisdruid.service.MasterService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Desc : Master控制类 12 | * Author : Jetictors 13 | * Time : 2019/8/6 17:25 14 | * Email : zhengxcfutures@gmail.com 15 | * Version : v-1.0.1 16 | */ 17 | 18 | @RestController 19 | @RequestMapping("/test") 20 | public class MasterController { 21 | 22 | @Autowired 23 | private MasterService masterService; 24 | 25 | @RequestMapping(value = "/master/{masterId}", method = RequestMethod.GET) 26 | public MasterEntity getMasterByIdOne(@PathVariable int masterId){ 27 | return masterService.getMasterById(masterId); 28 | } 29 | 30 | 31 | @RequestMapping(value = "/master/once", method = RequestMethod.GET) 32 | public MasterEntity getMasterByIdTwo(@RequestParam("masterId") int masterId){ 33 | return masterService.getMasterById(masterId); 34 | } 35 | 36 | @RequestMapping(value = "/master/all", method = RequestMethod.GET) 37 | public List getMasterList(){ 38 | return masterService.getMasterList(); 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/dao/CityDao.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.dao; 2 | 3 | import com.jetictors.example.mybatis.model.City; 4 | import org.apache.ibatis.annotations.*; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Desc : 城市dao类 10 | * Author : Jetictors 11 | * Time : 2019/8/6 15:21 12 | * Email : zhengxcfutures@gmail.com 13 | * Version : v-1.0.1 14 | */ 15 | @Mapper 16 | public interface CityDao { 17 | 18 | /** 19 | * 根据城市名称获取城市数据 20 | * @param cityName 城市名称 21 | * @return 22 | */ 23 | @Select("select * from city where cityName='${cityName}'") 24 | @Results({ 25 | @Result(property = "cityId", column = "cityId"), 26 | @Result(property = "provinceId", column = "provinceId"), 27 | @Result(property = "cityName", column = "cityName"), 28 | @Result(property = "description", column = "description") 29 | }) 30 | City getCityByName(@Param("cityName") String cityName); 31 | 32 | /** 33 | * 获取城市列表 34 | * @return 35 | */ 36 | @Select("select * from city") 37 | @Results({ 38 | @Result(property = "cityId", column = "cityId"), 39 | @Result(property = "provinceId", column = "provinceId"), 40 | @Result(property = "cityName", column = "cityName"), 41 | @Result(property = "description", column = "description") 42 | }) 43 | List getCityList(); 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/model/ResultBean.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Desc : 接口统一返回包装 7 | * Author : Jetictors 8 | * Time : 2019/8/14 10:36 9 | * Email : zhengxcfutures@gmail.com 10 | * Version : v-1.0.1 11 | */ 12 | public class ResultBean implements Serializable { 13 | 14 | private static final long serialVersionUID = 1L; 15 | public static final int SUCCESS = 0; 16 | public static final int FAIL = 1; 17 | public static final int NO_PERMISSION = 2; 18 | 19 | private String msg = "success"; 20 | private int code = SUCCESS; 21 | private T data; 22 | 23 | public ResultBean() { 24 | super(); 25 | } 26 | 27 | public ResultBean(T data) { 28 | super(); 29 | this.data = data; 30 | } 31 | 32 | public ResultBean(Throwable e) { 33 | super(); 34 | this.msg = e.toString(); 35 | this.code = FAIL ; 36 | } 37 | 38 | public String getMsg() { 39 | return msg; 40 | } 41 | 42 | public void setMsg(String msg) { 43 | this.msg = msg; 44 | } 45 | 46 | public int getCode() { 47 | return code; 48 | } 49 | 50 | public void setCode(int code) { 51 | this.code = code; 52 | } 53 | 54 | public T getData() { 55 | return data; 56 | } 57 | 58 | public void setData(T data) { 59 | this.data = data; 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /mybatis-druid/master.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog Enterprise v12.09 (64 bit) 3 | MySQL - 8.0.17 : Database - master 4 | ********************************************************************* 5 | */ 6 | 7 | /*!40101 SET NAMES utf8 */; 8 | 9 | /*!40101 SET SQL_MODE=''*/; 10 | 11 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 12 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 13 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 14 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 15 | CREATE DATABASE /*!32312 IF NOT EXISTS*/`master` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; 16 | 17 | USE `master`; 18 | 19 | /*Table structure for table `t_master` */ 20 | 21 | DROP TABLE IF EXISTS `t_master`; 22 | 23 | CREATE TABLE `t_master` ( 24 | `masterId` int(11) NOT NULL AUTO_INCREMENT, 25 | `name` text COLLATE utf8_unicode_ci NOT NULL, 26 | `des` text COLLATE utf8_unicode_ci, 27 | `time` time NOT NULL, 28 | PRIMARY KEY (`masterId`) 29 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 30 | 31 | /*Data for the table `t_master` */ 32 | 33 | insert into `t_master`(`masterId`,`name`,`des`,`time`) values (1,'first master','master 第一条数据','00:00:00'),(2,'second master','master 第二条数据','00:00:00'); 34 | 35 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 36 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 37 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 38 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 39 | -------------------------------------------------------------------------------- /hello/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.6.RELEASE 9 | 10 | 11 | com.jetictors.example 12 | hello 13 | 0.0.1-SNAPSHOT 14 | hello 15 | Hello World project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-test 30 | test 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.springframework.boot 38 | spring-boot-maven-plugin 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /jpa/src/main/java/com/jetictors/example/jpa/model/BaseModel.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.jpa.model; 2 | 3 | /** 4 | * Desc : 接口返回基类 5 | * Author : Jetictors 6 | * Time : 2019/8/7 15:20 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class BaseModel { 11 | 12 | private int code; 13 | 14 | private String msg; 15 | 16 | private boolean status; 17 | 18 | private T data; 19 | 20 | public BaseModel() { } 21 | 22 | public BaseModel(int code, String msg, boolean status, T data) { 23 | this.code = code; 24 | this.msg = msg; 25 | this.status = status; 26 | this.data = data; 27 | } 28 | 29 | public int getCode() { 30 | return code; 31 | } 32 | 33 | public void setCode(int code) { 34 | this.code = code; 35 | } 36 | 37 | public String getMsg() { 38 | return msg; 39 | } 40 | 41 | public void setMsg(String msg) { 42 | this.msg = msg; 43 | } 44 | 45 | public boolean isStatus() { 46 | return status; 47 | } 48 | 49 | public void setStatus(boolean status) { 50 | this.status = status; 51 | } 52 | 53 | public T getData() { 54 | return data; 55 | } 56 | 57 | public void setData(T data) { 58 | this.data = data; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "BaseModel{" + 64 | "code=" + code + 65 | ", msg='" + msg + '\'' + 66 | ", status=" + status + 67 | ", data=" + data + 68 | '}'; 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /log/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 10 | 11 | 12 | 13 | 14 | 15 | 16 | ${LOG_HOME}/TestWeb.log.%d{yyyy-MM-dd}.log 17 | 18 | 30 19 | 20 | 21 | 22 | %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n 23 | 24 | 25 | 26 | 10MB 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /free-marker/src/main/java/com/jetictors/example/freemarker/model/BaseModel.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.freemarker.model; 2 | 3 | /** 4 | * Desc : 接口返回基类 5 | * Author : Jetictors 6 | * Time : 2019/8/7 15:20 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class BaseModel { 11 | 12 | private int code; 13 | 14 | private String msg; 15 | 16 | private boolean status; 17 | 18 | private T data; 19 | 20 | public BaseModel() { } 21 | 22 | public BaseModel(int code, String msg, boolean status, T data) { 23 | this.code = code; 24 | this.msg = msg; 25 | this.status = status; 26 | this.data = data; 27 | } 28 | 29 | public int getCode() { 30 | return code; 31 | } 32 | 33 | public void setCode(int code) { 34 | this.code = code; 35 | } 36 | 37 | public String getMsg() { 38 | return msg; 39 | } 40 | 41 | public void setMsg(String msg) { 42 | this.msg = msg; 43 | } 44 | 45 | public boolean isStatus() { 46 | return status; 47 | } 48 | 49 | public void setStatus(boolean status) { 50 | this.status = status; 51 | } 52 | 53 | public T getData() { 54 | return data; 55 | } 56 | 57 | public void setData(T data) { 58 | this.data = data; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "BaseModel{" + 64 | "code=" + code + 65 | ", msg='" + msg + '\'' + 66 | ", status=" + status + 67 | ", data=" + data + 68 | '}'; 69 | } 70 | } 71 | 72 | -------------------------------------------------------------------------------- /jpa/src/main/java/com/jetictors/example/jpa/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.jpa.service.impl; 2 | 3 | import com.jetictors.example.jpa.dao.UserDao; 4 | import com.jetictors.example.jpa.model.User; 5 | import com.jetictors.example.jpa.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.List; 10 | import java.util.Optional; 11 | 12 | /** 13 | * Desc : 用户业务实现类 14 | * Author : Jetictors 15 | * Time : 2019/8/13 15:34 16 | * Email : zhengxcfutures@gmail.com 17 | * Version : v-1.0.1 18 | */ 19 | @Service 20 | public class UserServiceImpl implements UserService { 21 | 22 | @Autowired 23 | private UserDao userDao; 24 | 25 | @Override 26 | public List getAllList() { 27 | return userDao.findAll(); 28 | } 29 | 30 | @Override 31 | public User getUserById(String userId) { 32 | Optional optional = userDao.findById(userId); 33 | return optional.orElse(null); 34 | } 35 | 36 | @Override 37 | public User getUserByName(String userName) { 38 | return userDao.getUserByName(userName); 39 | } 40 | 41 | @Override 42 | public User addUser(User user) { 43 | return userDao.save(user); 44 | } 45 | 46 | @Override 47 | public User deleteUser(String userId) { 48 | Optional optional = userDao.findById(userId); 49 | userDao.delete(optional.get()); 50 | return optional.orElse(null); 51 | } 52 | 53 | @Override 54 | public User updateUser(User user) { 55 | return userDao.save(user); 56 | } 57 | } 58 | 59 | -------------------------------------------------------------------------------- /swagger/src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 22 | 23 | 24 | insert into user (userId, userName, pwd, nickName, age, sex) 25 | value (#{userId}, #{userName}, #{pwd}, #{nickName}, #{age}, #{sex}) 26 | 27 | 28 | 29 | delete from user where userId=#{userId} 30 | 31 | 32 | 33 | update user set 34 | user.userName=#{userName} 35 | , user.pwd=#{pwd} 36 | , user.nickName=#{nickName} 37 | , user.age=#{age} 38 | , user.sex=#{sex} 39 | where user.userId=#{userId} 40 | 41 | 42 | -------------------------------------------------------------------------------- /mybatis-druid/cluster.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog Enterprise v12.09 (64 bit) 3 | MySQL - 8.0.17 : Database - cluster 4 | ********************************************************************* 5 | */ 6 | 7 | /*!40101 SET NAMES utf8 */; 8 | 9 | /*!40101 SET SQL_MODE=''*/; 10 | 11 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 12 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 13 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 14 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 15 | CREATE DATABASE /*!32312 IF NOT EXISTS*/`cluster` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; 16 | 17 | USE `cluster`; 18 | 19 | /*Table structure for table `t_cluster` */ 20 | 21 | DROP TABLE IF EXISTS `t_cluster`; 22 | 23 | CREATE TABLE `t_cluster` ( 24 | `clusterId` int(11) NOT NULL AUTO_INCREMENT, 25 | `masterId` int(11) NOT NULL, 26 | `name` text COLLATE utf8_unicode_ci NOT NULL, 27 | `des` text COLLATE utf8_unicode_ci, 28 | `time` time NOT NULL, 29 | PRIMARY KEY (`clusterId`) 30 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 31 | 32 | /*Data for the table `t_cluster` */ 33 | 34 | insert into `t_cluster`(`clusterId`,`masterId`,`name`,`des`,`time`) values (1,1,'first cluster','cluster 第一条数据','00:00:00'),(2,1,'second cluster','cluster 第二条数据','00:00:00'),(3,2,'third cluster','cluster 第三条数据','00:00:00'),(4,2,'forth cluster','cluster 第四条数据','00:00:00'); 35 | 36 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 37 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 38 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 39 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 40 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.controller; 2 | 3 | import com.jetictors.example.mybatis.model.User; 4 | import com.jetictors.example.mybatis.service.UserService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Desc : 控制类 12 | * Author : Jetictors 13 | * Time : 2019/8/6 12:32 14 | * Email : zhengxcfutures@gmail.com 15 | * Version : v-1.0.1 16 | */ 17 | @RestController 18 | @RequestMapping("/test") 19 | public class UserController { 20 | 21 | @Autowired 22 | private UserService userService; 23 | 24 | /** 25 | * 查询单个用户对象 26 | * @PathVariable 为映射,即参数也是url的一部分 访问url的时候为 .../user/1001 27 | * @param userId 用户id 28 | * @return 29 | */ 30 | @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET) 31 | public User getUserByIdOne(@PathVariable String userId){ 32 | return userService.getUserById(userId); 33 | } 34 | 35 | /** 36 | * 查询单个用户对象 37 | * @RequestParam 请求参数 访问url的时候为 .../user/once?userId=1001 38 | * @param userId 用户id 39 | * @return 40 | */ 41 | @RequestMapping(value = "/user/once", method = RequestMethod.GET) 42 | public User getUserByIdTwo(@RequestParam(value = "userId") String userId){ 43 | return userService.getUserById(userId); 44 | } 45 | 46 | /** 47 | * 查询全部用户对象 48 | * @return 49 | */ 50 | @RequestMapping(value = "/user/all", method = RequestMethod.GET) 51 | public List getUserList(){ 52 | return userService.getUserList(); 53 | } 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /free-marker/src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 22 | 23 | 24 | insert into user (userId, userName, pwd, nickName, age, sex) 25 | value (#{userId}, #{userName}, #{pwd}, #{nickName}, #{age}, #{sex}) 26 | 27 | 28 | 29 | delete from user where userId=#{userId} 30 | 31 | 32 | 33 | update user set 34 | user.userName=#{userName} 35 | , user.pwd=#{pwd} 36 | , user.nickName=#{nickName} 37 | , user.age=#{age} 38 | , user.sex=#{sex} 39 | where user.userId=#{userId} 40 | 41 | 42 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/model/MasterEntity.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.model; 2 | 3 | /** 4 | * Desc : 主数据库实体类 5 | * Author : Jetictors 6 | * Time : 2019/8/6 16:32 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class MasterEntity { 11 | 12 | private int masterId; 13 | 14 | private String name; 15 | 16 | private String des; 17 | 18 | private String time; 19 | 20 | public MasterEntity() { } 21 | 22 | public MasterEntity(int masterId, String name, String des, String time) { 23 | this.masterId = masterId; 24 | this.name = name; 25 | this.des = des; 26 | this.time = time; 27 | } 28 | 29 | public int getMasterId() { 30 | return masterId; 31 | } 32 | 33 | public void setMasterId(int masterId) { 34 | this.masterId = masterId; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public void setName(String name) { 42 | this.name = name; 43 | } 44 | 45 | public String getDes() { 46 | return des; 47 | } 48 | 49 | public void setDes(String des) { 50 | this.des = des; 51 | } 52 | 53 | public String getTime() { 54 | return time; 55 | } 56 | 57 | public void setTime(String time) { 58 | this.time = time; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "MasterEntity{" + 64 | "masterId=" + masterId + 65 | ", name='" + name + '\'' + 66 | ", des='" + des + '\'' + 67 | ", time='" + time + '\'' + 68 | '}'; 69 | } 70 | 71 | } 72 | 73 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/controller/CityController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.controller; 2 | 3 | import com.jetictors.example.mybatis.model.City; 4 | import com.jetictors.example.mybatis.service.CityService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Desc : 城市控制类 12 | * Author : Jetictors 13 | * Time : 2019/8/6 15:29 14 | * Email : zhengxcfutures@gmail.com 15 | * Version : v-1.0.1 16 | */ 17 | @RestController 18 | @RequestMapping("/test") 19 | public class CityController { 20 | 21 | @Autowired 22 | private CityService cityService; 23 | 24 | /** 25 | * 查询单个城市对象 26 | * @PathVariable 为映射,即参数也是url的一部分 访问url的时候为 .../city/深圳 27 | * @param cityName 城市名称 28 | * @return 29 | */ 30 | @RequestMapping(value = "/city/{cityName}", method = RequestMethod.GET) 31 | public City getCityByNameOne(@PathVariable String cityName){ 32 | return cityService.getCityByName(cityName); 33 | } 34 | 35 | /** 36 | * 查询单个城市对象 37 | * @RequestParam 请求参数 访问url的时候为 .../user/once?city=深圳 38 | * @param cityName 城市名称 39 | * @return 40 | */ 41 | @RequestMapping(value = "/city/once", method = RequestMethod.GET) 42 | public City getCityByNameTwo(@RequestParam(value = "cityName") String cityName){ 43 | return cityService.getCityByName(cityName); 44 | } 45 | 46 | /** 47 | * 查询全部城市对象 48 | * @return 49 | */ 50 | @RequestMapping(value = "/city/all", method = RequestMethod.GET) 51 | public List getCityList(){ 52 | return cityService.getCityList(); 53 | } 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/model/City.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.model; 2 | 3 | /** 4 | * Desc : 城市实体类对象 5 | * Author : Jetictors 6 | * Time : 2019/8/6 14:12 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class City { 11 | 12 | private long cityId; 13 | 14 | private long provinceId; 15 | 16 | private String cityName; 17 | 18 | private String description; 19 | 20 | public City(){} 21 | 22 | public City(long cityId, long provinceId, String cityName, String description) { 23 | this.cityId = cityId; 24 | this.provinceId = provinceId; 25 | this.cityName = cityName; 26 | this.description = description; 27 | } 28 | 29 | public long getCityId() { 30 | return cityId; 31 | } 32 | 33 | public void setCityId(long cityId) { 34 | this.cityId = cityId; 35 | } 36 | 37 | public long getProvinceId() { 38 | return provinceId; 39 | } 40 | 41 | public void setProvinceId(long provinceId) { 42 | this.provinceId = provinceId; 43 | } 44 | 45 | public String getCityName() { 46 | return cityName; 47 | } 48 | 49 | public void setCityName(String cityName) { 50 | this.cityName = cityName; 51 | } 52 | 53 | public String getDescription() { 54 | return description; 55 | } 56 | 57 | public void setDescription(String description) { 58 | this.description = description; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "City{" + 64 | "cityId=" + cityId + 65 | ", provinceId=" + provinceId + 66 | ", cityName='" + cityName + '\'' + 67 | ", description='" + description + '\'' + 68 | '}'; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/model/City.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.model; 2 | 3 | /** 4 | * Desc : 城市实体类对象 5 | * Author : Jetictors 6 | * Time : 2019/8/6 14:12 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class City { 11 | 12 | private long cityId; 13 | 14 | private long provinceId; 15 | 16 | private String cityName; 17 | 18 | private String description; 19 | 20 | public City(){} 21 | 22 | public City(long cityId, long provinceId, String cityName, String description) { 23 | this.cityId = cityId; 24 | this.provinceId = provinceId; 25 | this.cityName = cityName; 26 | this.description = description; 27 | } 28 | 29 | public long getCityId() { 30 | return cityId; 31 | } 32 | 33 | public void setCityId(long cityId) { 34 | this.cityId = cityId; 35 | } 36 | 37 | public long getProvinceId() { 38 | return provinceId; 39 | } 40 | 41 | public void setProvinceId(long provinceId) { 42 | this.provinceId = provinceId; 43 | } 44 | 45 | public String getCityName() { 46 | return cityName; 47 | } 48 | 49 | public void setCityName(String cityName) { 50 | this.cityName = cityName; 51 | } 52 | 53 | public String getDescription() { 54 | return description; 55 | } 56 | 57 | public void setDescription(String description) { 58 | this.description = description; 59 | } 60 | 61 | @Override 62 | public String toString() { 63 | return "City{" + 64 | "cityId=" + cityId + 65 | ", provinceId=" + provinceId + 66 | ", cityName='" + cityName + '\'' + 67 | ", description='" + description + '\'' + 68 | '}'; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /properties/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.7.RELEASE 9 | 10 | 11 | com.jetictors.example 12 | properties 13 | 0.0.1-SNAPSHOT 14 | properties 15 | properties Learn project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-web 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-test 31 | test 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-configuration-processor 37 | true 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | org.springframework.boot 46 | spring-boot-maven-plugin 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /jpa/src/main/java/com/jetictors/example/jpa/model/User.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.jpa.model; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | 8 | /** 9 | * Desc : 用户尸体类 10 | * Author : Jetictors 11 | * Time : 2019/8/13 15:10 12 | * Email : zhengxcfutures@gmail.com 13 | * Version : v-1.0.1 14 | */ 15 | @Entity 16 | @Table(name = "tb_user") 17 | public class User { 18 | 19 | @Id 20 | @Column(name = "user_id", length = 32) 21 | private String userId; 22 | 23 | @Column(name = "user_name", length = 11) 24 | private String userName; 25 | 26 | @Column(name = "user_pwd", length = 16) 27 | private String userPwd; 28 | 29 | private String nickName; 30 | 31 | private int age; 32 | 33 | private int sex; 34 | 35 | public User() { } 36 | 37 | public String getUserId() { 38 | return userId; 39 | } 40 | 41 | public void setUserId(String userId) { 42 | this.userId = userId; 43 | } 44 | 45 | public String getUserName() { 46 | return userName; 47 | } 48 | 49 | public void setUserName(String userName) { 50 | this.userName = userName; 51 | } 52 | 53 | public String getUserPwd() { 54 | return userPwd; 55 | } 56 | 57 | public void setUserPwd(String userPwd) { 58 | this.userPwd = userPwd; 59 | } 60 | 61 | public String getNickName() { 62 | return nickName; 63 | } 64 | 65 | public void setNickName(String nickName) { 66 | this.nickName = nickName; 67 | } 68 | 69 | public int getAge() { 70 | return age; 71 | } 72 | 73 | public void setAge(int age) { 74 | this.age = age; 75 | } 76 | 77 | public int getSex() { 78 | return sex; 79 | } 80 | 81 | public void setSex(int sex) { 82 | this.sex = sex; 83 | } 84 | } 85 | 86 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/service/impl/DruidServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.service.impl; 2 | 3 | import com.jetictors.example.mybatisdruid.dao.cluster.ClusterDao; 4 | import com.jetictors.example.mybatisdruid.dao.master.MasterDao; 5 | import com.jetictors.example.mybatisdruid.model.ClusterEntity; 6 | import com.jetictors.example.mybatisdruid.model.DruidEntity; 7 | import com.jetictors.example.mybatisdruid.model.MasterEntity; 8 | import com.jetictors.example.mybatisdruid.service.DruidService; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Service; 11 | 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | 15 | /** 16 | * Desc : 业务实现类 17 | * Author : Jetictors 18 | * Time : 2019/8/6 17:08 19 | * Email : zhengxcfutures@gmail.com 20 | * Version : v-1.0.1 21 | */ 22 | 23 | @Service 24 | public class DruidServiceImpl implements DruidService { 25 | 26 | @Autowired 27 | private MasterDao masterDao; 28 | 29 | @Autowired 30 | private ClusterDao clusterDao; 31 | 32 | @Override 33 | public DruidEntity getDruidById(int masterId) { 34 | MasterEntity master = masterDao.getMasterById(masterId); 35 | List clusterList = clusterDao.getClusterByMasterId(masterId); 36 | 37 | DruidEntity entity = new DruidEntity(master, clusterList); 38 | return entity; 39 | } 40 | 41 | @Override 42 | public List getDruidList() { 43 | 44 | List druidList = new ArrayList<>(); 45 | 46 | List masterList = masterDao.getMasterList(); 47 | for (MasterEntity master : masterList){ 48 | List clusterList = clusterDao.getClusterByMasterId(master.getMasterId()); 49 | 50 | druidList.add(new DruidEntity(master, clusterList)); 51 | } 52 | 53 | return druidList; 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /mybatis/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | com.jetictorsexample 7 | mybatis 8 | 0.0.1-SNAPSHOT 9 | mybatis 10 | MyBatis Learn project for Spring Boot 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 2.1.6.RELEASE 16 | 17 | 18 | 19 | 20 | 1.8 21 | 22 | 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-starter-web 27 | 28 | 29 | 30 | org.mybatis.spring.boot 31 | mybatis-spring-boot-starter 32 | 2.1.0 33 | 34 | 35 | 36 | mysql 37 | mysql-connector-java 38 | runtime 39 | 40 | 41 | 42 | org.springframework.boot 43 | spring-boot-starter-test 44 | test 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-maven-plugin 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/controller/ClusterController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.controller; 2 | 3 | import com.jetictors.example.mybatisdruid.model.ClusterEntity; 4 | import com.jetictors.example.mybatisdruid.service.ClusterService; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.web.bind.annotation.*; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Desc : Cluster控制类 12 | * Author : Jetictors 13 | * Time : 2019/8/6 17:25 14 | * Email : zhengxcfutures@gmail.com 15 | * Version : v-1.0.1 16 | */ 17 | 18 | @RestController 19 | @RequestMapping("/test") 20 | public class ClusterController { 21 | 22 | @Autowired 23 | private ClusterService clusterService; 24 | 25 | @RequestMapping(value = "/cluster/clusterId/{clusterId}", method = RequestMethod.GET) 26 | public ClusterEntity getClusterByClusterIdOne(@PathVariable int clusterId){ 27 | return clusterService.getClusterByClusterId(clusterId); 28 | } 29 | 30 | 31 | @RequestMapping(value = "/cluster/clusterId/once", method = RequestMethod.GET) 32 | public ClusterEntity getClusterByClusterIdTwo(@RequestParam("clusterId") int clusterId){ 33 | return clusterService.getClusterByClusterId(clusterId); 34 | } 35 | 36 | @RequestMapping(value = "/cluster/masterId/{masterId}", method = RequestMethod.GET) 37 | public List getClusterByMasterIdOne(@PathVariable int masterId){ 38 | return clusterService.getClusterByMasterId(masterId); 39 | } 40 | 41 | 42 | @RequestMapping(value = "/cluster/masterId/once", method = RequestMethod.GET) 43 | public List getClusterByMasterIdTwo(@RequestParam("masterId") int masterId){ 44 | return clusterService.getClusterByMasterId(masterId); 45 | } 46 | 47 | @RequestMapping(value = "/cluster/all", method = RequestMethod.GET) 48 | public List getClusterList(){ 49 | return clusterService.getClusterList(); 50 | } 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/model/ClusterEntity.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.model; 2 | 3 | /** 4 | * Desc : 从数据库实体类 5 | * Author : Jetictors 6 | * Time : 2019/8/6 16:32 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class ClusterEntity { 11 | 12 | private int clusterId; 13 | 14 | private int masterId; 15 | 16 | private String name; 17 | 18 | private String des; 19 | 20 | private String time; 21 | 22 | public ClusterEntity() { } 23 | 24 | public ClusterEntity(int clusterId, int masterId, String name, String des, String time) { 25 | this.clusterId = clusterId; 26 | this.masterId = masterId; 27 | this.name = name; 28 | this.des = des; 29 | this.time = time; 30 | } 31 | 32 | public int getClusterId() { 33 | return clusterId; 34 | } 35 | 36 | public void setClusterId(int clusterId) { 37 | this.clusterId = clusterId; 38 | } 39 | 40 | public int getMasterId() { 41 | return masterId; 42 | } 43 | 44 | public void setMasterId(int masterId) { 45 | this.masterId = masterId; 46 | } 47 | 48 | public String getName() { 49 | return name; 50 | } 51 | 52 | public void setName(String name) { 53 | this.name = name; 54 | } 55 | 56 | public String getDes() { 57 | return des; 58 | } 59 | 60 | public void setDes(String des) { 61 | this.des = des; 62 | } 63 | 64 | public String getTime() { 65 | return time; 66 | } 67 | 68 | public void setTime(String time) { 69 | this.time = time; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "ClusterEntity{" + 75 | "clusterId=" + clusterId + 76 | "masterId=" + masterId + 77 | ", name='" + name + '\'' + 78 | ", des='" + des + '\'' + 79 | ", time='" + time + '\'' + 80 | '}'; 81 | } 82 | 83 | } 84 | 85 | -------------------------------------------------------------------------------- /jpa/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.jetictors.example 7 | jpa 8 | 0.0.1-SNAPSHOT 9 | jpa 10 | Jpa Learn project for Spring Boot 11 | 12 | 13 | org.springframework.boot 14 | spring-boot-starter-parent 15 | 2.1.7.RELEASE 16 | 17 | 18 | 19 | 20 | 1.8 21 | 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-data-jpa 28 | 2.1.6.RELEASE 29 | 30 | 31 | 32 | mysql 33 | mysql-connector-java 34 | runtime 35 | 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-web 40 | 41 | 42 | 43 | org.projectlombok 44 | lombok 45 | true 46 | 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-starter-test 51 | test 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.springframework.boot 60 | spring-boot-maven-plugin 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /mybatis/demo.sql: -------------------------------------------------------------------------------- 1 | /* 2 | SQLyog Enterprise v12.09 (64 bit) 3 | MySQL - 8.0.17 : Database - demo 4 | ********************************************************************* 5 | */ 6 | 7 | /*!40101 SET NAMES utf8 */; 8 | 9 | /*!40101 SET SQL_MODE=''*/; 10 | 11 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 12 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 13 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 14 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 15 | CREATE DATABASE /*!32312 IF NOT EXISTS*/`demo` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */ /*!80016 DEFAULT ENCRYPTION='N' */; 16 | 17 | USE `demo`; 18 | 19 | /*Table structure for table `city` */ 20 | 21 | DROP TABLE IF EXISTS `city`; 22 | 23 | CREATE TABLE `city` ( 24 | `cityId` int(11) NOT NULL AUTO_INCREMENT, 25 | `provinceId` int(11) NOT NULL, 26 | `cityName` text COLLATE utf8_unicode_ci NOT NULL, 27 | `description` text COLLATE utf8_unicode_ci, 28 | PRIMARY KEY (`cityId`) 29 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 30 | 31 | /*Data for the table `city` */ 32 | 33 | insert into `city`(`cityId`,`provinceId`,`cityName`,`description`) values (1,1001,'太原','太原好热啊'),(2,1002,'深圳','深圳靠海啊'),(3,1003,'广州',NULL); 34 | 35 | /*Table structure for table `user` */ 36 | 37 | DROP TABLE IF EXISTS `user`; 38 | 39 | CREATE TABLE `user` ( 40 | `userId` int(11) NOT NULL, 41 | `userName` text COLLATE utf8_unicode_ci NOT NULL, 42 | `pwd` text COLLATE utf8_unicode_ci NOT NULL, 43 | `nickName` text COLLATE utf8_unicode_ci, 44 | `age` int(11) DEFAULT NULL, 45 | `sex` int(11) NOT NULL DEFAULT '0' 46 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 47 | 48 | /*Data for the table `user` */ 49 | 50 | insert into `user`(`userId`,`userName`,`pwd`,`nickName`,`age`,`sex`) values (1001,'18875023340','123456','张三',25,0),(1002,'18875023341','123456','李四',22,0),(1003,'18875023342','123456',NULL,30,1); 51 | 52 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 53 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 54 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 55 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 56 | -------------------------------------------------------------------------------- /mybatis/src/main/java/com/jetictors/example/mybatis/model/User.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatis.model; 2 | 3 | /** 4 | * Desc : 用户实体类对象 5 | * Author : Jetictors 6 | * Time : 2019/8/6 14:12 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class User { 11 | 12 | private long userId; 13 | 14 | private String userName; 15 | 16 | private String pwd; 17 | 18 | private String nickName; 19 | 20 | private int age; 21 | 22 | private int sex; 23 | 24 | public User(){} 25 | 26 | public User(long userId, String userName, String pwd, String nickName, int age, int sex) { 27 | this.userId = userId; 28 | this.userName = userName; 29 | this.pwd = pwd; 30 | this.nickName = nickName; 31 | this.age = age; 32 | this.sex = sex; 33 | } 34 | 35 | public long getUserId() { 36 | return userId; 37 | } 38 | 39 | public void setUserId(long userId) { 40 | this.userId = userId; 41 | } 42 | 43 | public String getUserName() { 44 | return userName; 45 | } 46 | 47 | public void setUserName(String userName) { 48 | this.userName = userName; 49 | } 50 | 51 | public String getPwd() { 52 | return pwd; 53 | } 54 | 55 | public void setPwd(String pwd) { 56 | this.pwd = pwd; 57 | } 58 | 59 | public String getNickName() { 60 | return nickName; 61 | } 62 | 63 | public void setNickName(String nickName) { 64 | this.nickName = nickName; 65 | } 66 | 67 | public int getAge() { 68 | return age; 69 | } 70 | 71 | public void setAge(int age) { 72 | this.age = age; 73 | } 74 | 75 | public int getSex() { 76 | return sex; 77 | } 78 | 79 | public void setSex(int sex) { 80 | this.sex = sex; 81 | } 82 | 83 | @Override 84 | public String toString() { 85 | return "User{" + 86 | "userId=" + userId + 87 | ", userName='" + userName + '\'' + 88 | ", pwd='" + pwd + '\'' + 89 | ", nickName='" + nickName + '\'' + 90 | ", age=" + age + 91 | ", sex=" + sex + 92 | '}'; 93 | } 94 | } 95 | 96 | 97 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/model/User.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.model; 2 | 3 | /** 4 | * Desc : 用户实体类 5 | * Author : Jetictors 6 | * Time : 2019/8/14 10:36 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class User { 11 | 12 | private long userId; 13 | 14 | private String userName; 15 | 16 | private String pwd; 17 | 18 | private String nickName; 19 | 20 | private int age; 21 | 22 | private int sex; 23 | 24 | public User(){} 25 | 26 | public User(long userId, String userName, String pwd, String nickName, int age, int sex) { 27 | this.userId = userId; 28 | this.userName = userName; 29 | this.pwd = pwd; 30 | this.nickName = nickName; 31 | this.age = age; 32 | this.sex = sex; 33 | } 34 | 35 | public long getUserId() { 36 | return userId; 37 | } 38 | 39 | public void setUserId(long userId) { 40 | this.userId = userId; 41 | } 42 | 43 | public String getUserName() { 44 | return userName; 45 | } 46 | 47 | public void setUserName(String userName) { 48 | this.userName = userName; 49 | } 50 | 51 | public String getPwd() { 52 | return pwd; 53 | } 54 | 55 | public void setPwd(String pwd) { 56 | this.pwd = pwd; 57 | } 58 | 59 | public String getNickName() { 60 | return nickName; 61 | } 62 | 63 | public void setNickName(String nickName) { 64 | this.nickName = nickName; 65 | } 66 | 67 | public int getAge() { 68 | return age; 69 | } 70 | 71 | public void setAge(int age) { 72 | this.age = age; 73 | } 74 | 75 | public int getSex() { 76 | return sex; 77 | } 78 | 79 | public void setSex(int sex) { 80 | this.sex = sex; 81 | } 82 | 83 | @Override 84 | public String toString() { 85 | return "User{" + 86 | "userId=" + userId + 87 | ", userName='" + userName + '\'' + 88 | ", pwd='" + pwd + '\'' + 89 | ", nickName='" + nickName + '\'' + 90 | ", age=" + age + 91 | ", sex=" + sex + 92 | '}'; 93 | } 94 | 95 | } 96 | 97 | -------------------------------------------------------------------------------- /free-marker/src/main/java/com/jetictors/example/freemarker/model/User.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.freemarker.model; 2 | 3 | /** 4 | * Desc : 用户实体类对象 5 | * Author : Jetictors 6 | * Time : 2019/8/6 14:12 7 | * Email : zhengxcfutures@gmail.com 8 | * Version : v-1.0.1 9 | */ 10 | public class User { 11 | 12 | private long userId; 13 | 14 | private String userName; 15 | 16 | private String pwd; 17 | 18 | private String nickName; 19 | 20 | private int age; 21 | 22 | private int sex; 23 | 24 | public User(){} 25 | 26 | public User(long userId, String userName, String pwd, String nickName, int age, int sex) { 27 | this.userId = userId; 28 | this.userName = userName; 29 | this.pwd = pwd; 30 | this.nickName = nickName; 31 | this.age = age; 32 | this.sex = sex; 33 | } 34 | 35 | public long getUserId() { 36 | return userId; 37 | } 38 | 39 | public void setUserId(long userId) { 40 | this.userId = userId; 41 | } 42 | 43 | public String getUserName() { 44 | return userName; 45 | } 46 | 47 | public void setUserName(String userName) { 48 | this.userName = userName; 49 | } 50 | 51 | public String getPwd() { 52 | return pwd; 53 | } 54 | 55 | public void setPwd(String pwd) { 56 | this.pwd = pwd; 57 | } 58 | 59 | public String getNickName() { 60 | return nickName; 61 | } 62 | 63 | public void setNickName(String nickName) { 64 | this.nickName = nickName; 65 | } 66 | 67 | public int getAge() { 68 | return age; 69 | } 70 | 71 | public void setAge(int age) { 72 | this.age = age; 73 | } 74 | 75 | public int getSex() { 76 | return sex; 77 | } 78 | 79 | public void setSex(int sex) { 80 | this.sex = sex; 81 | } 82 | 83 | @Override 84 | public String toString() { 85 | return "User{" + 86 | "userId=" + userId + 87 | ", userName='" + userName + '\'' + 88 | ", pwd='" + pwd + '\'' + 89 | ", nickName='" + nickName + '\'' + 90 | ", age=" + age + 91 | ", sex=" + sex + 92 | '}'; 93 | } 94 | } 95 | 96 | 97 | -------------------------------------------------------------------------------- /free-marker/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.jetictors.example 6 | free-marker 7 | 0.0.1-SNAPSHOT 8 | free-marker 9 | FreeMarker Learn project for Spring Boot 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 2.1.7.RELEASE 15 | 16 | 17 | 18 | 19 | 1.8 20 | 2.1.0 21 | 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-freemarker 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-starter-web 33 | 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-test 38 | test 39 | 40 | 41 | 42 | mysql 43 | mysql-connector-java 44 | runtime 45 | 46 | 47 | 48 | 49 | org.mybatis.spring.boot 50 | mybatis-spring-boot-starter 51 | ${mybatis-spring-boot-starter} 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.springframework.boot 60 | spring-boot-maven-plugin 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/config/ClusterDataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.config; 2 | 3 | import org.apache.ibatis.session.SqlSessionFactory; 4 | import org.mybatis.spring.SqlSessionFactoryBean; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.springframework.beans.factory.annotation.Qualifier; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; 11 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; 12 | 13 | import javax.sql.DataSource; 14 | 15 | @Configuration 16 | // 扫描 Mapper 接口并容器管理 17 | @MapperScan(basePackages = ClusterDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "clusterSqlSessionFactory") 18 | public class ClusterDataSourceConfig extends CommonConfig{ 19 | 20 | // 精确到 cluster 目录,以便跟其他数据源隔离 21 | static final String PACKAGE = "com.jetictors.example.mybatisdruid.dao.cluster"; 22 | static final String MAPPER_LOCATION = "classpath:mapper/cluster/*.xml"; 23 | 24 | @Value("${cluster.datasource.url}") 25 | private String url; 26 | 27 | @Value("${cluster.datasource.username}") 28 | private String user; 29 | 30 | @Value("${cluster.datasource.password}") 31 | private String password; 32 | 33 | @Value("${cluster.datasource.driverClassName}") 34 | private String driverClass; 35 | 36 | @Bean(name = "clusterDataSource") 37 | public DataSource clusterDataSource() { 38 | System.out.println(driverClass); 39 | return getDataSource(url, driverClass, user, password); 40 | } 41 | 42 | @Bean(name = "clusterTransactionManager") 43 | public DataSourceTransactionManager clusterTransactionManager() { 44 | return new DataSourceTransactionManager(clusterDataSource()); 45 | } 46 | 47 | @Bean(name = "clusterSqlSessionFactory") 48 | public SqlSessionFactory clusterSqlSessionFactory(@Qualifier("clusterDataSource") DataSource clusterDataSource) 49 | throws Exception { 50 | final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); 51 | sessionFactory.setDataSource(clusterDataSource); 52 | sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver() 53 | .getResources(ClusterDataSourceConfig.MAPPER_LOCATION)); 54 | return sessionFactory.getObject(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /mybatis-druid/src/main/java/com/jetictors/example/mybatisdruid/config/MasterDataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.mybatisdruid.config; 2 | 3 | import org.apache.ibatis.session.SqlSessionFactory; 4 | import org.mybatis.spring.SqlSessionFactoryBean; 5 | import org.mybatis.spring.annotation.MapperScan; 6 | import org.springframework.beans.factory.annotation.Qualifier; 7 | import org.springframework.beans.factory.annotation.Value; 8 | import org.springframework.context.annotation.Bean; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.context.annotation.Primary; 11 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; 12 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; 13 | 14 | import javax.sql.DataSource; 15 | 16 | @Configuration 17 | // 扫描 Mapper 接口并容器管理 18 | @MapperScan(basePackages = MasterDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "masterSqlSessionFactory") 19 | public class MasterDataSourceConfig extends CommonConfig{ 20 | 21 | // 精确到 master 目录,以便跟其他数据源隔离 22 | static final String PACKAGE = "com.jetictors.example.mybatisdruid.dao.master"; 23 | 24 | private static final String MAPPER_LOCATION = "classpath:mapper/master/*.xml"; 25 | 26 | @Value("${master.datasource.url}") 27 | private String url; 28 | 29 | @Value("${master.datasource.username}") 30 | private String user; 31 | 32 | @Value("${master.datasource.password}") 33 | private String password; 34 | 35 | @Value("${master.datasource.driverClassName}") 36 | private String driverClass; 37 | 38 | @Primary 39 | @Bean(name = "masterDataSource") 40 | public DataSource masterDataSource() { 41 | return getDataSource(url, driverClass, user, password); 42 | } 43 | 44 | @Primary 45 | @Bean(name = "masterTransactionManager") 46 | public DataSourceTransactionManager masterTransactionManager() { 47 | return new DataSourceTransactionManager(masterDataSource()); 48 | } 49 | 50 | @Primary 51 | @Bean(name = "masterSqlSessionFactory") 52 | public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource) 53 | throws Exception { 54 | final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); 55 | sessionFactory.setDataSource(masterDataSource); 56 | sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver() 57 | .getResources(MasterDataSourceConfig.MAPPER_LOCATION)); 58 | return sessionFactory.getObject(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /log/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.jetictors.example 6 | log 7 | 0.0.1-SNAPSHOT 8 | log 9 | logger leran project for Spring Boot 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 2.1.6.RELEASE 15 | 16 | 17 | 18 | 19 | 1.8 20 | 1.2.3 21 | 1.7.25 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | 31 | org.projectlombok 32 | lombok 33 | true 34 | 35 | 36 | org.springframework.boot 37 | spring-boot-starter-test 38 | test 39 | 40 | 41 | 42 | 43 | org.slf4j 44 | slf4j-api 45 | ${slf4j-version} 46 | compile 47 | 48 | 49 | 50 | 51 | ch.qos.logback 52 | logback-classic 53 | ${logback-version} 54 | 55 | 56 | 57 | ch.qos.logback 58 | logback-core 59 | ${logback-version} 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | org.springframework.boot 68 | spring-boot-maven-plugin 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /properties/src/main/java/com/jetictors/example/properties/property/UserProperty.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.properties.property; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | /** 7 | * Desc : User配置文件(User属性) 8 | * Author : Jetictors 9 | * Time : 2019/8/8 12:05 10 | * Email : zhengxcfutures@gmail.com 11 | * Version : v-1.0.1 12 | */ 13 | 14 | @Component 15 | @ConfigurationProperties(prefix = "user") 16 | public class UserProperty { 17 | 18 | private int userId; 19 | 20 | private String userName; 21 | 22 | private String pwd; 23 | 24 | private String nickName; 25 | 26 | private int age; 27 | 28 | private int sex; 29 | 30 | public UserProperty() { } 31 | 32 | public UserProperty(int userId, String userName, String pwd, String nickName, int age, int sex) { 33 | this.userId = userId; 34 | this.userName = userName; 35 | this.pwd = pwd; 36 | this.nickName = nickName; 37 | this.age = age; 38 | this.sex = sex; 39 | } 40 | 41 | public int getUserId() { 42 | return userId; 43 | } 44 | 45 | public void setUserId(int userId) { 46 | this.userId = userId; 47 | } 48 | 49 | public String getUserName() { 50 | return userName; 51 | } 52 | 53 | public void setUserName(String userName) { 54 | this.userName = userName; 55 | } 56 | 57 | public String getPwd() { 58 | return pwd; 59 | } 60 | 61 | public void setPwd(String pwd) { 62 | this.pwd = pwd; 63 | } 64 | 65 | public String getNickName() { 66 | return nickName; 67 | } 68 | 69 | public void setNickName(String nickName) { 70 | this.nickName = nickName; 71 | } 72 | 73 | public int getAge() { 74 | return age; 75 | } 76 | 77 | public void setAge(int age) { 78 | this.age = age; 79 | } 80 | 81 | public int getSex() { 82 | return sex; 83 | } 84 | 85 | public void setSex(int sex) { 86 | this.sex = sex; 87 | } 88 | 89 | @Override 90 | public String toString() { 91 | return "UserProperty{" + 92 | "userId=" + userId + 93 | ", userName='" + userName + '\'' + 94 | ", pwd='" + pwd + '\'' + 95 | ", nickName='" + nickName + '\'' + 96 | ", age=" + age + 97 | ", sex=" + sex + 98 | '}'; 99 | } 100 | } 101 | 102 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/controller/CityController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.controller; 2 | 3 | import com.jetictors.example.swagger.model.City; 4 | import com.jetictors.example.swagger.model.ResultBean; 5 | import com.jetictors.example.swagger.service.CityService; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiImplicitParam; 8 | import io.swagger.annotations.ApiImplicitParams; 9 | import io.swagger.annotations.ApiOperation; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * Desc : 城市控制类 17 | * Author : Jetictors 18 | * Time : 2019/8/14 14:44 19 | * Email : zhengxcfutures@gmail.com 20 | * Version : v-1.0.1 21 | */ 22 | @Api(description = "城市相关操作接口", tags = "city") 23 | @RequestMapping("/test") 24 | @RestController 25 | public class CityController { 26 | 27 | @Autowired 28 | private CityService cityService; 29 | 30 | @ApiOperation(value = "getCityByName", notes = "根据城市名称获取城市数据") 31 | @ApiImplicitParams( 32 | @ApiImplicitParam(name = "cityName", value = "城市名称") 33 | ) 34 | @GetMapping("/city/{cityName}") 35 | public ResultBean getCityByName(@PathVariable String cityName){ 36 | return new ResultBean(cityService.getCityByName(cityName)); 37 | } 38 | 39 | 40 | @ApiOperation(value = "getCityList", notes = "获取城市列表") 41 | @GetMapping("/city/all") 42 | public ResultBean> getCityList(){ 43 | return new ResultBean>(cityService.getCityList()); 44 | } 45 | 46 | 47 | @ApiOperation(value = "deleteCityByName", notes = "根据城市名称删除城市数据") 48 | @ApiImplicitParams( 49 | @ApiImplicitParam(name = "cityName", value = "城市名称") 50 | ) 51 | @DeleteMapping(value = "/city/delete/{cityName}") 52 | public ResultBean deleteCityByName(@PathVariable String cityName){ 53 | cityService.deleteCityByName(cityName); 54 | return new ResultBean(); 55 | } 56 | 57 | @ApiOperation(value = "addCity", notes = "添加城市") 58 | @ApiImplicitParams({ 59 | @ApiImplicitParam(name = "cityId", value = "城市id"), 60 | @ApiImplicitParam(name = "provinceId", value = "次级id"), 61 | @ApiImplicitParam(name = "cityName", value = "城市名称"), 62 | @ApiImplicitParam(name = "description", value = "说明"), 63 | }) 64 | @PostMapping(value = "/city/add") 65 | public ResultBean addCity(City city){ 66 | cityService.addCity(city); 67 | return new ResultBean(); 68 | } 69 | 70 | } 71 | 72 | -------------------------------------------------------------------------------- /mybatis-druid/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.jetictors.example 6 | mybatis-druid 7 | 0.0.1-SNAPSHOT 8 | mybatis-druid 9 | MyBatis Druid Learn project for Spring Boot 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 2.1.6.RELEASE 15 | 16 | 17 | 18 | 19 | 1.8 20 | 2.1.0 21 | 1.1.16 22 | 23 | 24 | 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-web 30 | 31 | 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-test 36 | test 37 | 38 | 39 | 40 | 41 | org.mybatis.spring.boot 42 | mybatis-spring-boot-starter 43 | ${mybatis-spring-boot-starter} 44 | 45 | 46 | 47 | 48 | mysql 49 | mysql-connector-java 50 | runtime 51 | 52 | 53 | 54 | org.projectlombok 55 | lombok 56 | true 57 | 58 | 59 | 60 | 61 | com.alibaba 62 | druid 63 | ${druid} 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | org.springframework.boot 72 | spring-boot-maven-plugin 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /jpa/src/main/java/com/jetictors/example/jpa/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.jpa.controller; 2 | 3 | import com.jetictors.example.jpa.model.BaseModel; 4 | import com.jetictors.example.jpa.model.User; 5 | import com.jetictors.example.jpa.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.bind.annotation.*; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Desc : 用户控制类 13 | * Author : Jetictors 14 | * Time : 2019/8/13 15:31 15 | * Email : zhengxcfutures@gmail.com 16 | * Version : v-1.0.1 17 | */ 18 | @RestController 19 | @RequestMapping("/test") 20 | public class UserController { 21 | 22 | @Autowired 23 | private UserService userService; 24 | 25 | @RequestMapping(value = "/user/get", method = RequestMethod.GET) 26 | public BaseModel getUserByName(@RequestParam("userName") String userName){ 27 | User user = userService.getUserByName(userName); 28 | return getBaseModel(1001, "success", true, user); 29 | } 30 | 31 | @RequestMapping(value = "/user/{userId}", method = RequestMethod.GET) 32 | public BaseModel getUserById(@PathVariable String userId){ 33 | User user = userService.getUserById(userId); 34 | return getBaseModel(1001, "success", true, user); 35 | } 36 | 37 | @RequestMapping(value = "/user/all", method = RequestMethod.GET) 38 | public BaseModel> getAllList(){ 39 | List userList = userService.getAllList(); 40 | return getBaseModel(1001, "success", true, userList); 41 | } 42 | 43 | @RequestMapping(value = "/user/delete", method = RequestMethod.GET) 44 | public BaseModel deleteUserById(@RequestParam("userId") String userId){ 45 | User result = userService.deleteUser(userId); 46 | if (result != null){ 47 | return getBaseModel(1001, "success", true, null); 48 | }else { 49 | return getBaseModel(1002, "failed", false, null); 50 | } 51 | } 52 | 53 | @RequestMapping(value = "/user/update", method = RequestMethod.POST) 54 | public BaseModel updateUser(User user){ 55 | User result = userService.updateUser(user); 56 | if (result != null){ 57 | return getBaseModel(1001, "success", true, null); 58 | }else { 59 | return getBaseModel(1002, "failed", false, null); 60 | } 61 | } 62 | 63 | @RequestMapping(value = "/user/add", method = RequestMethod.POST) 64 | public BaseModel addUser(User user){ 65 | User result = userService.addUser(user); 66 | if (result != null){ 67 | return getBaseModel(1001, "success", true, null); 68 | }else { 69 | return getBaseModel(1002, "failed", false, null); 70 | } 71 | } 72 | 73 | private BaseModel getBaseModel(int code, String msg, boolean status , T data){ 74 | return new BaseModel<>(code, msg, status, data); 75 | } 76 | 77 | } 78 | 79 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.controller; 2 | 3 | import com.jetictors.example.swagger.model.ResultBean; 4 | import com.jetictors.example.swagger.model.User; 5 | import com.jetictors.example.swagger.service.UserService; 6 | import io.swagger.annotations.Api; 7 | import io.swagger.annotations.ApiImplicitParam; 8 | import io.swagger.annotations.ApiImplicitParams; 9 | import io.swagger.annotations.ApiOperation; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.bind.annotation.*; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * Desc : 用户控制类 17 | * Author : Jetictors 18 | * Time : 2019/8/14 10:38 19 | * Email : zhengxcfutures@gmail.com 20 | * Version : v-1.0.1 21 | */ 22 | 23 | @Api(description = "用户相关操作接口", tags = "user") 24 | @RestController 25 | @RequestMapping("/test") 26 | public class UserController{ 27 | 28 | @Autowired 29 | private UserService userService; 30 | 31 | @ApiOperation(value = "getUserById", notes = "根据用户id获取用户数据") 32 | @ApiImplicitParams( 33 | @ApiImplicitParam(name = "userId", value = "用户id") 34 | ) 35 | @GetMapping("/user/{userId}") 36 | public ResultBean getUserById(@PathVariable long userId){ 37 | return new ResultBean(userService.getUserById(userId)); 38 | } 39 | 40 | 41 | @ApiOperation(value = "getUserList", notes = "获取用户列表") 42 | @GetMapping("/user/all") 43 | public ResultBean> getUserList(){ 44 | return new ResultBean>(userService.getUserList()); 45 | } 46 | 47 | 48 | @ApiOperation(value = "deleteUserById", notes = "根据用户id删除用户数据") 49 | @ApiImplicitParams( 50 | @ApiImplicitParam(name = "userId", value = "用户id") 51 | ) 52 | @DeleteMapping(value = "/user/delete/{userId}") 53 | public ResultBean deleteUserById(@PathVariable long userId){ 54 | userService.deleteUserById(userId); 55 | return new ResultBean(); 56 | } 57 | 58 | 59 | @ApiOperation(value = "updateUser", notes = "更新用户数据") 60 | @ApiImplicitParams({ 61 | @ApiImplicitParam(name = "userId", value = "用户id"), 62 | @ApiImplicitParam(name = "userName", value = "用户名"), 63 | @ApiImplicitParam(name = "pwd", value = "用户密码"), 64 | @ApiImplicitParam(name = "nickName", value = "昵称"), 65 | @ApiImplicitParam(name = "age", value = "年龄"), 66 | @ApiImplicitParam(name = "sex", value = "性别") 67 | }) 68 | @PostMapping(value = "/user/update") 69 | public ResultBean updateUser(User user){ 70 | userService.updateUser(user); 71 | return new ResultBean(); 72 | } 73 | 74 | @ApiOperation(value = "addUser", notes = "添加用户") 75 | @ApiImplicitParams({ 76 | @ApiImplicitParam(name = "userId", value = "用户id"), 77 | @ApiImplicitParam(name = "userName", value = "用户名"), 78 | @ApiImplicitParam(name = "pwd", value = "用户密码"), 79 | @ApiImplicitParam(name = "nickName", value = "昵称"), 80 | @ApiImplicitParam(name = "age", value = "年龄"), 81 | @ApiImplicitParam(name = "sex", value = "性别") 82 | }) 83 | @PostMapping(value = "/user/add") 84 | public ResultBean addUser(User user){ 85 | userService.addUser(user); 86 | return new ResultBean(); 87 | } 88 | 89 | } 90 | 91 | -------------------------------------------------------------------------------- /swagger/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.jetictors.example 6 | swagger 7 | 0.0.1-SNAPSHOT 8 | swagger 9 | Swagger Learn project for Spring Boot 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 2.1.7.RELEASE 15 | 16 | 17 | 18 | 19 | 1.8 20 | 2.8.0 21 | 1.9.5 22 | 2.1.0 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-web 31 | 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-test 37 | test 38 | 39 | 40 | 41 | 42 | org.mybatis.spring.boot 43 | mybatis-spring-boot-starter 44 | ${mybatis-version} 45 | 46 | 47 | 48 | 49 | mysql 50 | mysql-connector-java 51 | runtime 52 | 53 | 54 | 55 | org.projectlombok 56 | lombok 57 | true 58 | 59 | 60 | 61 | 62 | io.springfox 63 | springfox-swagger2 64 | ${swagger-version} 65 | 66 | 67 | 68 | 69 | io.springfox 70 | springfox-swagger-ui 71 | ${swagger-version} 72 | 73 | 74 | com.github.xiaoymin 75 | swagger-bootstrap-ui 76 | ${swagger-bootstrap-ui} 77 | 78 | 79 | 80 | 81 | org.springframework.boot 82 | spring-boot-configuration-processor 83 | true 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | org.springframework.boot 92 | spring-boot-maven-plugin 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /free-marker/src/main/java/com/jetictors/example/freemarker/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.freemarker.controller; 2 | 3 | import com.jetictors.example.freemarker.model.BaseModel; 4 | import com.jetictors.example.freemarker.model.User; 5 | import com.jetictors.example.freemarker.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Controller; 8 | import org.springframework.ui.Model; 9 | import org.springframework.web.bind.annotation.*; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Desc : 用户控制类 15 | * Author : Jetictors 16 | * Time : 2019/8/7 11:36 17 | * Email : zhengxcfutures@gmail.com 18 | * Version : v-1.0.1 19 | */ 20 | @Controller 21 | @RequestMapping("/test") 22 | public class UserController { 23 | 24 | @Autowired 25 | private UserService userService; 26 | 27 | @ResponseBody 28 | @RequestMapping(value = "/api/user/{userId}", method = RequestMethod.GET) 29 | public BaseModel getUserById(@PathVariable String userId){ 30 | User user = userService.getUserById(userId); 31 | 32 | return getBaseModel(1001, "success", true, user); 33 | } 34 | 35 | @ResponseBody 36 | @RequestMapping(value = "/api/user/all", method = RequestMethod.GET) 37 | public BaseModel> getUserList(){ 38 | List userList = userService.getUserList(); 39 | return getBaseModel(1001, "success", true, userList); 40 | } 41 | 42 | @ResponseBody 43 | @RequestMapping(value = "/api/user/delete", method = RequestMethod.GET) 44 | public BaseModel deleteUserById(@RequestParam("userId") String userId){ 45 | int result = userService.deleteUserById(userId); 46 | 47 | if (result > 0){ 48 | return getBaseModel(1001, "success", true, null); 49 | }else { 50 | return getBaseModel(1002, "failed", false, null); 51 | } 52 | 53 | } 54 | 55 | @ResponseBody 56 | @RequestMapping(value = "/api/user/update", method = RequestMethod.POST) 57 | public BaseModel updateUser(User user){ 58 | int result = userService.updateUser(user); 59 | 60 | if (result > 0){ 61 | return getBaseModel(1001, "success", true, null); 62 | }else { 63 | return getBaseModel(1002, "failed", false, null); 64 | } 65 | } 66 | 67 | @ResponseBody 68 | @RequestMapping(value = "/api/user/add", method = RequestMethod.POST) 69 | public BaseModel addUser(User user){ 70 | int result = userService.addUser(user); 71 | 72 | if (result > 0){ 73 | return getBaseModel(1001, "success", true, null); 74 | }else { 75 | return getBaseModel(1002, "failed", false, null); 76 | } 77 | } 78 | 79 | @RequestMapping("/page/index") 80 | public String toPageIndex(){ 81 | return "index"; 82 | } 83 | 84 | @RequestMapping(value = "/page/user/{userId}", method = RequestMethod.GET) 85 | public String toPageUser(Model model, @PathVariable("userId") String userId){ 86 | model.addAttribute("user",userService.getUserById(userId)); 87 | return "userInfo"; 88 | } 89 | 90 | @RequestMapping("/page/userList") 91 | public String toPageUserList(Model model){ 92 | model.addAttribute("userList",userService.getUserList()); 93 | return "userList"; 94 | } 95 | 96 | private BaseModel getBaseModel(int code, String msg, boolean status , T data){ 97 | return new BaseModel<>(code, msg, status, data); 98 | } 99 | 100 | } 101 | 102 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/config/SwaggerConfig.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.config; 2 | 3 | import com.jetictors.example.swagger.property.SwaggerProperty; 4 | import io.swagger.annotations.ApiOperation; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.http.ResponseEntity; 9 | import org.springframework.web.bind.annotation.RequestMethod; 10 | import springfox.documentation.builders.ApiInfoBuilder; 11 | import springfox.documentation.builders.PathSelectors; 12 | import springfox.documentation.builders.RequestHandlerSelectors; 13 | import springfox.documentation.builders.ResponseMessageBuilder; 14 | import springfox.documentation.service.ApiInfo; 15 | import springfox.documentation.service.Contact; 16 | import springfox.documentation.service.ResponseMessage; 17 | import springfox.documentation.spi.DocumentationType; 18 | import springfox.documentation.spring.web.plugins.Docket; 19 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 20 | 21 | import java.time.LocalDate; 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | /** 26 | * Desc : swagger配置类 27 | * Author : Jetictors 28 | * Time : 2019/8/14 10:41 29 | * Email : zhengxcfutures@gmail.com 30 | * Version : v-1.0.1 31 | */ 32 | @Configuration 33 | @EnableSwagger2 34 | public class SwaggerConfig { 35 | 36 | @Autowired 37 | private SwaggerProperty property; 38 | 39 | private ApiInfo apiInfo(){ 40 | 41 | Contact contact = new Contact(property.getContactName(), property.getContactUrl(), property.getContactEmail()); 42 | 43 | return new ApiInfoBuilder().title(property.getTitle()) 44 | .description(property.getDesc()) 45 | .version(property.getVersion()) 46 | .termsOfServiceUrl(property.getTermsOfServiceUrl()) 47 | .license(property.getLicense()) 48 | .licenseUrl(property.getLicenseUrl()) 49 | .contact(contact) 50 | .build(); 51 | } 52 | 53 | @Bean 54 | public Docket swaggerApi(){ 55 | return new Docket(DocumentationType.SWAGGER_2) 56 | .apiInfo(apiInfo()) 57 | .groupName(property.getGroupName()) 58 | .directModelSubstitute(LocalDate.class, String.class).genericModelSubstitutes(ResponseEntity.class) 59 | .useDefaultResponseMessages(false) 60 | // .globalResponseMessage(RequestMethod.POST, customerResponseMessage()) 61 | // .globalResponseMessage(RequestMethod.GET, customerResponseMessage()) 62 | .forCodeGeneration(true) 63 | .select() 64 | .apis(RequestHandlerSelectors.basePackage(property.getBasePackage())) 65 | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) 66 | .paths(PathSelectors.any()) 67 | .build(); 68 | } 69 | 70 | // private List customerResponseMessage() { 71 | // List list = new ArrayList<>(); 72 | // list.add(new ResponseMessageBuilder().code(200).message("请求成功").build()); 73 | // list.add(new ResponseMessageBuilder().code(201).message("资源创建成功").build()); 74 | // list.add(new ResponseMessageBuilder().code(204).message("服务器成功处理了请求,但不需要返回任何实体内容").build()); 75 | // list.add(new ResponseMessageBuilder().code(400).message("请求失败,具体查看返回业务状态码与对应消息").build()); 76 | // list.add(new ResponseMessageBuilder().code(401).message("请求失败,未经过身份认证").build()); 77 | // list.add(new ResponseMessageBuilder().code(405).message("请求方法不支持").build()); 78 | // list.add(new ResponseMessageBuilder().code(415).message("请求媒体类型不支持").build()); 79 | // list.add(new ResponseMessageBuilder().code(500).message("服务器遇到了一个未曾预料的状况,导致了它无法完成对请求的处理").build()); 80 | // list.add(new ResponseMessageBuilder().code(503).message("服务器当前无法处理请求,这个状况是临时的,并且将在一段时间以后恢复").build()); 81 | // return list; 82 | // } 83 | 84 | } 85 | 86 | -------------------------------------------------------------------------------- /swagger/src/main/java/com/jetictors/example/swagger/property/SwaggerProperty.java: -------------------------------------------------------------------------------- 1 | package com.jetictors.example.swagger.property; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.stereotype.Component; 5 | 6 | /** 7 | * Desc : swagger属性配置 8 | * Author : Jetictors 9 | * Time : 2019/8/14 10:44 10 | * Email : zhengxcfutures@gmail.com 11 | * Version : v-1.0.1 12 | */ 13 | @Component 14 | @ConfigurationProperties(prefix = "swagger", value = "swagger") 15 | public class SwaggerProperty { 16 | 17 | /** 18 | * 文档标题 19 | */ 20 | private String title; 21 | 22 | /** 23 | * 版本号 24 | */ 25 | private String version; 26 | 27 | /** 28 | * 文档说明 29 | */ 30 | private String desc; 31 | 32 | private String termsOfServiceUrl; 33 | 34 | /** 35 | * 认证 36 | */ 37 | private String license; 38 | 39 | /** 40 | * 认证地址 41 | */ 42 | private String licenseUrl; 43 | 44 | 45 | private String basePackage; 46 | 47 | private String groupName; 48 | 49 | private String contactName; 50 | 51 | private String contactUrl; 52 | 53 | private String contactEmail; 54 | 55 | public String getTitle() { 56 | return title; 57 | } 58 | 59 | public void setTitle(String title) { 60 | this.title = title; 61 | } 62 | 63 | public String getVersion() { 64 | return version; 65 | } 66 | 67 | public void setVersion(String version) { 68 | this.version = version; 69 | } 70 | 71 | public String getDesc() { 72 | return desc; 73 | } 74 | 75 | public void setDesc(String desc) { 76 | this.desc = desc; 77 | } 78 | 79 | public String getTermsOfServiceUrl() { 80 | return termsOfServiceUrl; 81 | } 82 | 83 | public void setTermsOfServiceUrl(String termsOfServiceUrl) { 84 | this.termsOfServiceUrl = termsOfServiceUrl; 85 | } 86 | 87 | public String getLicense() { 88 | return license; 89 | } 90 | 91 | public void setLicense(String license) { 92 | this.license = license; 93 | } 94 | 95 | public String getLicenseUrl() { 96 | return licenseUrl; 97 | } 98 | 99 | public void setLicenseUrl(String licenseUrl) { 100 | this.licenseUrl = licenseUrl; 101 | } 102 | 103 | public String getBasePackage() { 104 | return basePackage; 105 | } 106 | 107 | public void setBasePackage(String basePackage) { 108 | this.basePackage = basePackage; 109 | } 110 | 111 | public String getGroupName() { 112 | return groupName; 113 | } 114 | 115 | public void setGroupName(String groupName) { 116 | this.groupName = groupName; 117 | } 118 | 119 | public String getContactName() { 120 | return contactName; 121 | } 122 | 123 | public void setContactName(String contactName) { 124 | this.contactName = contactName; 125 | } 126 | 127 | public String getContactUrl() { 128 | return contactUrl; 129 | } 130 | 131 | public void setContactUrl(String contactUrl) { 132 | this.contactUrl = contactUrl; 133 | } 134 | 135 | public String getContactEmail() { 136 | return contactEmail; 137 | } 138 | 139 | public void setContactEmail(String contactEmail) { 140 | this.contactEmail = contactEmail; 141 | } 142 | 143 | @Override 144 | public String toString() { 145 | return "SwaggerProperty{" + 146 | "title='" + title + '\'' + 147 | ", version='" + version + '\'' + 148 | ", desc='" + desc + '\'' + 149 | ", termsOfServiceUrl='" + termsOfServiceUrl + '\'' + 150 | ", license='" + license + '\'' + 151 | ", licenseUrl='" + licenseUrl + '\'' + 152 | ", basePackage='" + basePackage + '\'' + 153 | ", groupName='" + groupName + '\'' + 154 | ", contactName='" + contactName + '\'' + 155 | ", contactUrl='" + contactUrl + '\'' + 156 | ", contactEmail='" + contactEmail + '\'' + 157 | '}'; 158 | } 159 | } 160 | 161 | -------------------------------------------------------------------------------- /hello/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /jpa/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /log/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /mybatis/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /swagger/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /free-marker/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /properties/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /mybatis-druid/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | https://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /hello/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /jpa/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /log/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM https://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | --------------------------------------------------------------------------------