11 | }
--------------------------------------------------------------------------------
/spring-boot-apollo/src/main/resources/META_INF/app.properties:
--------------------------------------------------------------------------------
1 | app.id=Spring-Boot-Apollo
--------------------------------------------------------------------------------
/spring-boot-apollo/src/test/kotlin/com/jaycekon/apollo/SpringBootApolloApplicationTests.kt:
--------------------------------------------------------------------------------
1 | package com.jaycekon.apollo
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 | class SpringBootApolloApplicationTests {
11 |
12 | @Test
13 | fun contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/spring-boot-cloud-consumer/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle/
--------------------------------------------------------------------------------
/spring-boot-cloud-consumer/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | server.port=2101
2 |
3 | spring.application.name=service-ribbon
4 | eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
--------------------------------------------------------------------------------
/spring-boot-cloud-consumer/src/test/java/com/jaycekon/cloud/SpringBootCloudConsumerApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.cloud;
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 SpringBootCloudConsumerApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/spring-boot-cloud-provider/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle/
--------------------------------------------------------------------------------
/spring-boot-cloud-provider/src/main/java/com/jaycekon/cloud/SpringBootCloudProviderApplication.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.cloud;
2 |
3 | import org.springframework.boot.autoconfigure.SpringBootApplication;
4 | import org.springframework.boot.builder.SpringApplicationBuilder;
5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 |
7 | @SpringBootApplication
8 | @EnableDiscoveryClient
9 | public class SpringBootCloudProviderApplication {
10 |
11 | public static void main(String[] args) {
12 |
13 | new SpringApplicationBuilder(
14 | SpringBootCloudProviderApplication.class)
15 | .web(true).run(args);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/spring-boot-cloud-provider/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.application.name=eureka-client
2 | server.port=2003
3 | eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
--------------------------------------------------------------------------------
/spring-boot-cloud-provider/src/test/java/com/jaycekon/cloud/SpringBootCloudProviderApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.cloud;
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 SpringBootCloudProviderApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/spring-boot-cloud/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle/
--------------------------------------------------------------------------------
/spring-boot-cloud/src/main/java/com/jaycekon/cloud/SpringBootCloudApplication.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.cloud;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | @SpringBootApplication
8 | @EnableEurekaServer
9 | public class SpringBootCloudApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(SpringBootCloudApplication.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/spring-boot-cloud/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.application.name=eureka-server
2 | server.port=8761
3 |
4 |
5 | eureka.instance.hostname=localhost
6 | eureka.client.register-with-eureka=false
7 | eureka.client.fetch-registry=false
--------------------------------------------------------------------------------
/spring-boot-cloud/src/test/java/com/jaycekon/cloud/SpringBootCloudApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.cloud;
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 SpringBootCloudApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/spring-boot-consumer/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle/
--------------------------------------------------------------------------------
/spring-boot-consumer/src/main/java/com/jaycekon/dubbo/service/CityDubboService.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.dubbo.service;
2 |
3 |
4 | import com.jaycekon.dubbo.domain.City;
5 |
6 | /**
7 | * 城市业务 Dubbo 服务层
8 | *
9 | * Created by Jaycekon on 20/09/2017.
10 | */
11 | public interface CityDubboService {
12 |
13 | /**
14 | * 根据城市名称,查询城市信息
15 | * @param cityName
16 | */
17 | City findCityByName(String cityName);
18 | }
19 |
--------------------------------------------------------------------------------
/spring-boot-consumer/src/main/java/com/jaycekon/dubbo/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.dubbo.service;
2 |
3 | import com.jaycekon.dubbo.domain.User;
4 |
5 | /**
6 | * Created by Jaycekon on 2017/9/19.
7 | */
8 | public interface UserService {
9 | User saveUser(User user);
10 | }
11 |
--------------------------------------------------------------------------------
/spring-boot-consumer/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | ## 避免和 server 工程端口冲突
2 | server.port=8081
3 |
4 | ## Dubbo 服务消费者配置
5 | spring.dubbo.application.name=consumer
6 | spring.dubbo.registry.address=zookeeper://127.0.0.1:2181
7 | spring.dubbo.scan=com.jaycekon.dubbo.service
--------------------------------------------------------------------------------
/spring-boot-consumer/src/test/java/com/jaycekon/mybatis/multi/SpringBootConsumerApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi;
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 SpringBootConsumerApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/spring-boot-dubbo/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle/
--------------------------------------------------------------------------------
/spring-boot-dubbo/src/main/java/com/jaycekon/dubbo/ServerApplication.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.dubbo;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * Spring Boot 应用启动类
8 | *
9 | * Created by Jaycekon on 20/09/2017.
10 | */
11 | // Spring Boot 应用的标识
12 | @SpringBootApplication
13 | public class ServerApplication {
14 |
15 | public static void main(String[] args) {
16 | // 程序启动入口
17 | // 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件
18 | SpringApplication.run(ServerApplication.class,args);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/spring-boot-dubbo/src/main/java/com/jaycekon/dubbo/service/CityDubboService.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.dubbo.service;
2 |
3 |
4 | import com.jaycekon.dubbo.domain.City;
5 |
6 | /**
7 | * 城市业务 Dubbo 服务层
8 | *
9 | * Created by Jaycekon on 20/09/2017.
10 | */
11 | public interface CityDubboService {
12 |
13 | /**
14 | * 根据城市名称,查询城市信息
15 | * @param cityName
16 | */
17 | City findCityByName(String cityName);
18 | }
19 |
--------------------------------------------------------------------------------
/spring-boot-dubbo/src/main/java/com/jaycekon/dubbo/service/UserService.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.dubbo.service;
2 |
3 | import com.jaycekon.dubbo.domain.User;
4 |
5 | /**
6 | * Created by Jaycekon on 2017/9/19.
7 | */
8 | public interface UserService {
9 |
10 | User saveUser(User user);
11 | }
12 |
--------------------------------------------------------------------------------
/spring-boot-dubbo/src/main/java/com/jaycekon/dubbo/service/impl/CityDubboServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.dubbo.service.impl;
2 |
3 | import com.alibaba.dubbo.config.annotation.Service;
4 | import com.jaycekon.dubbo.domain.City;
5 | import com.jaycekon.dubbo.service.CityDubboService;
6 |
7 | /**
8 | * 城市业务 Dubbo 服务层实现层
9 | *
10 | * Created by Jaycekon on 20/09/2017.
11 | */
12 | // 注册为 Dubbo 服务
13 | @Service
14 | public class CityDubboServiceImpl implements CityDubboService {
15 |
16 | public City findCityByName(String cityName) {
17 | return new City(1L,2L,"广州","是我的故乡");
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/spring-boot-dubbo/src/main/java/com/jaycekon/dubbo/service/impl/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.dubbo.service.impl;
2 |
3 | import com.alibaba.dubbo.config.annotation.Service;
4 | import com.jaycekon.dubbo.domain.User;
5 | import com.jaycekon.dubbo.service.UserService;
6 |
7 | /**
8 | * Created by Jaycekon on 2017/9/19.
9 | */
10 | @Service
11 | public class UserServiceImpl implements UserService {
12 |
13 | @Override
14 | public User saveUser(User user) {
15 | user.setId(1);
16 | System.out.println(user.toString());
17 | return user;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/spring-boot-dubbo/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | ## Dubbo 服务提供者配置
2 | spring.dubbo.application.name=provider
3 | spring.dubbo.registry.address=zookeeper://127.0.0.1:2181
4 | spring.dubbo.protocol.name=dubbo
5 | spring.dubbo.protocol.port=20880
6 | spring.dubbo.scan=com.jaycekon.dubbo.service
--------------------------------------------------------------------------------
/spring-boot-dubbo/src/test/java/com/jaycekon/dubbo/SpringBootDubboApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.dubbo;
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 SpringBootDubboApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/spring-boot-event/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
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 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/spring-boot-event/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaycekon/SpringBoot/384197ab4d8730616bb95dca079cce2579c5b030/spring-boot-event/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/spring-boot-event/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/spring-boot-event/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/spring-boot-event/src/test/java/com/jaycekon/event/EventApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.event;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class EventApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/java/com/jaycekon/mybatis/multi/SpringBootMybatisMultiApplication.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class SpringBootMybatisMultiApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(SpringBootMybatisMultiApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/java/com/jaycekon/mybatis/multi/config/DataSource.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi.config;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * @author
10 | * @date 2018/11/15
11 | */
12 | @Retention(RetentionPolicy.CLASS)
13 | @Target({ElementType.TYPE})
14 | public @interface DataSource {
15 | String value() default "test_1";
16 | }
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/java/com/jaycekon/mybatis/multi/config/DatabaseContextHolder.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi.config;
2 |
3 | /**
4 | * 保存一个线程安全的DatabaseType容器
5 | *
6 | * 用于保存数据源类型
7 | * 2018/1/15 18:57
8 | */
9 | public class DatabaseContextHolder {
10 | private static final ThreadLocal contextHolder = new ThreadLocal<>();
11 | public static final DatabaseType DEFAULT_DATASOURCE = DatabaseType.db1;
12 |
13 |
14 | public static void setDatabaseType(DatabaseType type) {
15 | contextHolder.set(type);
16 | }
17 |
18 | public static DatabaseType getDatabaseType() {
19 | return contextHolder.get();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/java/com/jaycekon/mybatis/multi/mapper/db1/SchoolMapper.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi.mapper.db1;
2 |
3 | import com.jaycekon.mybatis.multi.model.School;
4 |
5 | /**
6 | * @author
7 | * @date 2018/11/21
8 | */
9 | public interface SchoolMapper {
10 |
11 | void insert(School school);
12 |
13 | School select(int id);
14 | }
15 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/java/com/jaycekon/mybatis/multi/mapper/db2/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi.mapper.db2;
2 |
3 | import com.jaycekon.mybatis.multi.model.User;
4 |
5 | /**
6 | * @author
7 | * @date 2018/11/21
8 | */
9 | public interface UserMapper {
10 |
11 | void insert(User user);
12 |
13 | User select(int id);
14 | }
15 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/java/com/jaycekon/mybatis/multi/model/School.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi.model;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 |
6 | /**
7 | * @author jaycekon
8 | * @date 2018/11/21
9 | */
10 | @Data
11 | @AllArgsConstructor
12 | public class School {
13 | private int id;
14 | private String schoolName;
15 | private String province;
16 |
17 |
18 | public School(String schoolName, String province) {
19 | this.schoolName = schoolName;
20 | this.province = province;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/java/com/jaycekon/mybatis/multi/model/User.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi.model;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 |
6 | /**
7 | * @date 2018/11/21
8 | */
9 |
10 | @Data
11 | @AllArgsConstructor
12 | public class User {
13 | private int id;
14 |
15 | private String username;
16 |
17 | private String password;
18 |
19 | public User(String username, String password) {
20 | this.username = username;
21 | this.password = password;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/resources/mybatis-mappers/db1/SchoolMapper.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 | INSERT INTO `school`( `school_name`, `province`)
8 | VALUES ( #{schoolName}, #{province});
9 |
10 |
11 |
14 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/main/resources/mybatis-mappers/db2/UserMapper.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | INSERT INTO `user`(`username`, `password`)
7 | VALUES ( #{username}, #{password});
8 |
9 |
10 |
13 |
--------------------------------------------------------------------------------
/spring-boot-mybatis-multi/src/test/java/com/jaycekon/springbootmybatismulti/SpringBootMybatisMultiApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.springbootmybatismulti;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.mybatis.spring.annotation.MapperScan;
6 | import org.springframework.boot.test.context.SpringBootTest;
7 | import org.springframework.test.context.junit4.SpringRunner;
8 |
9 | @RunWith(SpringRunner.class)
10 | @SpringBootTest
11 | public class SpringBootMybatisMultiApplicationTests {
12 |
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/spring-boot-mybatis/.gitignore:
--------------------------------------------------------------------------------
1 | .gradle
2 | /build/
3 | !gradle/wrapper/gradle-wrapper.jar
4 |
5 | ### STS ###
6 | .apt_generated
7 | .classpath
8 | .factorypath
9 | .project
10 | .settings
11 | .springBeans
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | nbproject/private/
21 | build/
22 | nbbuild/
23 | dist/
24 | nbdist/
25 | .nb-gradle/
--------------------------------------------------------------------------------
/spring-boot-mybatis/src/main/java/com/jaycekon/demo/MyMapper.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.demo;
2 |
3 | import tk.mybatis.mapper.common.Mapper;
4 | import tk.mybatis.mapper.common.MySqlMapper;
5 |
6 | /**
7 | * Created by weijie_huang on 2017/9/7.
8 | */
9 | public interface MyMapper extends Mapper, MySqlMapper {
10 | }
11 |
--------------------------------------------------------------------------------
/spring-boot-mybatis/src/main/java/com/jaycekon/demo/SpringBootMybatisApplication.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.demo;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class SpringBootMybatisApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(SpringBootMybatisApplication.class, args);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/spring-boot-mybatis/src/main/java/com/jaycekon/demo/config/DatabaseContextHolder.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.demo.config;
2 |
3 | /**
4 | * 保存一个线程安全的DatabaseType容器
5 | *
6 | * 用于保存数据源类型
7 | * 2018/1/15 18:57
8 | */
9 | public class DatabaseContextHolder {
10 | private static final ThreadLocal contextHolder = new ThreadLocal<>();
11 |
12 | public static void setDatabaseType(DatabaseType type) {
13 | contextHolder.set(type);
14 | }
15 |
16 | public static DatabaseType getDatabaseType() {
17 | return contextHolder.get();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/spring-boot-mybatis/src/main/java/com/jaycekon/demo/mapper/UserMapper.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.demo.mapper;
2 |
3 | import com.jaycekon.demo.MyMapper;
4 | import com.jaycekon.demo.model.User;
5 | import org.apache.ibatis.annotations.Mapper;
6 | import org.apache.ibatis.annotations.Select;
7 | import org.springframework.beans.factory.annotation.Qualifier;
8 |
9 | /**
10 | * 2018/1/9 16:58
11 | */
12 | @Mapper
13 | @Qualifier(value = "UserMapper")
14 | public interface UserMapper extends MyMapper {
15 |
16 | @Select("select * from user where username=#{username}")
17 | User selectByName(String username);
18 |
19 | User selectByIdCard(String idCard);
20 | }
21 |
--------------------------------------------------------------------------------
/spring-boot-mybatis/src/main/java/com/jaycekon/demo/model/User.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.demo.model;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 | import lombok.NoArgsConstructor;
6 | import lombok.Setter;
7 | import lombok.experimental.Accessors;
8 |
9 | /**
10 | * Created by weijie_huang on 2017/9/7.
11 | */
12 |
13 | @Getter
14 | @Setter
15 | @NoArgsConstructor
16 | @AllArgsConstructor
17 | @Accessors(chain = true)
18 | public class User extends BaseEntity {
19 |
20 | private String password;
21 |
22 | private String username;
23 |
24 | private String idCard;
25 |
26 | private String phone;
27 | }
28 |
--------------------------------------------------------------------------------
/spring-boot-mybatis/src/test/java/com/jaycekon/demo/SpringBootMybatisApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.demo;
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 SpringBootMybatisApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/spring-boot-sentinel-ahas/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
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 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/spring-boot-sentinel-ahas/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaycekon/SpringBoot/384197ab4d8730616bb95dca079cce2579c5b030/spring-boot-sentinel-ahas/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/spring-boot-sentinel-ahas/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/spring-boot-sentinel-ahas/src/main/java/com/jaycekon/sentinel/ahas/IndexController.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.sentinel.ahas;
2 |
3 | import org.springframework.web.bind.annotation.RequestMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | /**
7 | * @author jiuling.hwj
8 | * @version v1 2021/7/3
9 | */
10 | @RestController
11 | public class IndexController {
12 |
13 | @RequestMapping("/index")
14 | public String index(){
15 | return "hello index";
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/spring-boot-sentinel-ahas/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/spring-boot-sentinel-ahas/src/test/java/com/jaycekon/sentinel/ahas/SentinelAhasApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.sentinel.ahas;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class SentinelAhasApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/spring-boot-sentinel/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
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 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/spring-boot-sentinel/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaycekon/SpringBoot/384197ab4d8730616bb95dca079cce2579c5b030/spring-boot-sentinel/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/spring-boot-sentinel/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/spring-boot-sentinel/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/spring-boot-sentinel/src/test/java/com/jaycekon/sentinel/SpringBootSentinelApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.sentinel;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class SpringBootSentinelApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/spring-boot-web/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle/
--------------------------------------------------------------------------------
/spring-boot-web/src/main/java/com/jaycekon/mybatis/multi/SpringBootWebApplication.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class SpringBootWebApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication springApplication = new SpringApplication(SpringBootWebApplication.class);
11 | springApplication.setWebEnvironment(true);
12 | springApplication.run(args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/spring-boot-web/src/main/java/com/jaycekon/mybatis/multi/dao/ReadRepository.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi.dao;
2 |
3 | import com.jaycekon.mybatis.multi.domain.Book;
4 | import org.springframework.data.jpa.repository.JpaRepository;
5 | import org.springframework.stereotype.Component;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by weijie_huang on 2017/9/20.
11 | */
12 | @Component
13 | public interface ReadRepository extends JpaRepository {
14 | List findByReader(String reader);
15 | }
16 |
--------------------------------------------------------------------------------
/spring-boot-web/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | management.security.enabled=false
--------------------------------------------------------------------------------
/spring-boot-web/src/main/resources/static/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #cccccc;
3 | font-family: arial,helvetica,sans-serif;
4 | }
5 | .bookHeadline {
6 | font-size: 12pt;
7 | font-weight: bold;
8 | }
9 |
10 | .bookDescription {
11 | font-size: 10pt;
12 | }
13 | label {
14 | font-weight: bold;
15 | }
--------------------------------------------------------------------------------
/spring-boot-web/src/test/java/com/jaycekon/mybatis/multi/SpringBootWebApplicationTests.java:
--------------------------------------------------------------------------------
1 | package com.jaycekon.mybatis.multi;
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 SpringBootWebApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------