├── .codacy.yml ├── .editorconfig ├── .gitee ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── PULL_REQUEST_TEMPLATE.md ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── maven.yml ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.en.md ├── README.md ├── TODO.en.md ├── TODO.md ├── pom.xml ├── spring-boot-demo-activiti ├── .gitignore ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── activiti │ │ │ ├── SpringBootDemoActivitiApplication.java │ │ │ ├── config │ │ │ └── SecurityConfiguration.java │ │ │ └── util │ │ │ └── SecurityUtil.java │ └── resources │ │ ├── application.yml │ │ └── processes │ │ └── team01.bpmn │ └── test │ └── java │ └── com │ └── xkcoding │ └── activiti │ └── SpringBootDemoActivitiApplicationTests.java ├── spring-boot-demo-actuator ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── actuator │ │ │ └── SpringBootDemoActuatorApplication.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── actuator │ └── SpringBootDemoActuatorApplicationTests.java ├── spring-boot-demo-admin ├── README.md ├── pom.xml ├── spring-boot-demo-admin-client │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── xkcoding │ │ │ │ └── admin │ │ │ │ └── client │ │ │ │ ├── SpringBootDemoAdminClientApplication.java │ │ │ │ └── controller │ │ │ │ └── IndexController.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── com │ │ └── xkcoding │ │ └── admin │ │ └── client │ │ └── SpringBootDemoAdminClientApplicationTests.java └── spring-boot-demo-admin-server │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── admin │ │ │ └── server │ │ │ └── SpringBootDemoAdminServerApplication.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── admin │ └── server │ └── SpringBootDemoAdminServerApplicationTests.java ├── spring-boot-demo-async ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── async │ │ │ ├── SpringBootDemoAsyncApplication.java │ │ │ └── task │ │ │ └── TaskFactory.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── async │ ├── SpringBootDemoAsyncApplicationTests.java │ └── task │ └── TaskFactoryTest.java ├── spring-boot-demo-cache-ehcache ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── cache │ │ │ └── ehcache │ │ │ ├── SpringBootDemoCacheEhcacheApplication.java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── service │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ └── UserServiceImpl.java │ └── resources │ │ ├── application.yml │ │ └── ehcache.xml │ └── test │ └── java │ └── com │ └── xkcoding │ └── cache │ └── ehcache │ ├── SpringBootDemoCacheEhcacheApplicationTests.java │ └── service │ └── UserServiceTest.java ├── spring-boot-demo-cache-redis ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── cache │ │ │ └── redis │ │ │ ├── SpringBootDemoCacheRedisApplication.java │ │ │ ├── config │ │ │ └── RedisConfig.java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── service │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ └── UserServiceImpl.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── cache │ └── redis │ ├── RedisTest.java │ ├── SpringBootDemoCacheRedisApplicationTests.java │ └── service │ └── UserServiceTest.java ├── spring-boot-demo-codegen ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── codegen │ │ │ ├── SpringBootDemoCodegenApplication.java │ │ │ ├── common │ │ │ ├── IResultCode.java │ │ │ ├── PageResult.java │ │ │ ├── R.java │ │ │ └── ResultCode.java │ │ │ ├── constants │ │ │ └── GenConstants.java │ │ │ ├── controller │ │ │ └── CodeGenController.java │ │ │ ├── entity │ │ │ ├── ColumnEntity.java │ │ │ ├── GenConfig.java │ │ │ ├── TableEntity.java │ │ │ └── TableRequest.java │ │ │ ├── service │ │ │ ├── CodeGenService.java │ │ │ └── impl │ │ │ │ └── CodeGenServiceImpl.java │ │ │ └── utils │ │ │ ├── CodeGenUtil.java │ │ │ └── DbUtil.java │ └── resources │ │ ├── application.yml │ │ ├── generator.properties │ │ ├── jdbc_type.properties │ │ ├── logback-spring.xml │ │ ├── static │ │ ├── index.html │ │ └── libs │ │ │ ├── axios │ │ │ └── axios.min.js │ │ │ ├── datejs │ │ │ └── date-zh-CN.js │ │ │ ├── iview │ │ │ ├── fonts │ │ │ │ ├── ionicons.svg │ │ │ │ ├── ionicons.ttf │ │ │ │ └── ionicons.woff │ │ │ ├── iview.css │ │ │ └── iview.min.js │ │ │ └── vue │ │ │ └── vue.min.js │ │ └── template │ │ ├── Controller.java.vm │ │ ├── Entity.java.vm │ │ ├── Mapper.java.vm │ │ ├── Mapper.xml.vm │ │ ├── Service.java.vm │ │ ├── ServiceImpl.java.vm │ │ └── api.js.vm │ └── test │ └── java │ └── com │ └── xkcoding │ └── codegen │ ├── CodeGenServiceTest.java │ └── SpringBootDemoCodegenApplicationTests.java ├── spring-boot-demo-docker ├── .gitignore ├── Dockerfile ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── docker │ │ │ ├── SpringBootDemoDockerApplication.java │ │ │ └── controller │ │ │ └── HelloController.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── docker │ └── SpringBootDemoDockerApplicationTests.java ├── spring-boot-demo-dubbo ├── .gitignore ├── README.md ├── pom.xml ├── spring-boot-demo-dubbo-common │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── xkcoding │ │ └── dubbo │ │ └── common │ │ └── service │ │ └── HelloService.java ├── spring-boot-demo-dubbo-consumer │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── xkcoding │ │ │ │ └── dubbo │ │ │ │ └── consumer │ │ │ │ ├── SpringBootDemoDubboConsumerApplication.java │ │ │ │ └── controller │ │ │ │ └── HelloController.java │ │ └── resources │ │ │ └── application.yml │ │ └── test │ │ └── java │ │ └── com │ │ └── xkcoding │ │ └── dubbo │ │ └── consumer │ │ └── SpringBootDemoDubboConsumerApplicationTests.java └── spring-boot-demo-dubbo-provider │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── dubbo │ │ │ └── provider │ │ │ ├── SpringBootDemoDubboProviderApplication.java │ │ │ └── service │ │ │ └── HelloServiceImpl.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── dubbo │ └── provider │ └── SpringBootDemoDubboProviderApplicationTests.java ├── spring-boot-demo-dynamic-datasource ├── .gitignore ├── README.md ├── db │ ├── init.sql │ └── user.sql ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── dynamic │ │ │ └── datasource │ │ │ ├── SpringBootDemoDynamicDatasourceApplication.java │ │ │ ├── annotation │ │ │ └── DefaultDatasource.java │ │ │ ├── aspect │ │ │ └── DatasourceSelectorAspect.java │ │ │ ├── config │ │ │ ├── DatasourceConfiguration.java │ │ │ ├── MyMapper.java │ │ │ └── MybatisConfiguration.java │ │ │ ├── controller │ │ │ ├── DatasourceConfigController.java │ │ │ └── UserController.java │ │ │ ├── datasource │ │ │ ├── DatasourceConfigCache.java │ │ │ ├── DatasourceConfigContextHolder.java │ │ │ ├── DatasourceHolder.java │ │ │ ├── DatasourceManager.java │ │ │ ├── DatasourceScheduler.java │ │ │ └── DynamicDataSource.java │ │ │ ├── mapper │ │ │ ├── DatasourceConfigMapper.java │ │ │ └── UserMapper.java │ │ │ ├── model │ │ │ ├── DatasourceConfig.java │ │ │ └── User.java │ │ │ └── utils │ │ │ └── SpringUtil.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── dynamic │ └── datasource │ └── SpringBootDemoDynamicDatasourceApplicationTests.java ├── spring-boot-demo-elasticsearch-rest-high-level-client ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── elasticsearch │ │ │ ├── ElasticsearchApplication.java │ │ │ ├── common │ │ │ ├── Result.java │ │ │ └── ResultCode.java │ │ │ ├── config │ │ │ ├── ElasticsearchAutoConfiguration.java │ │ │ └── ElasticsearchProperties.java │ │ │ ├── contants │ │ │ └── ElasticsearchConstant.java │ │ │ ├── exception │ │ │ └── ElasticsearchException.java │ │ │ ├── model │ │ │ └── Person.java │ │ │ └── service │ │ │ ├── PersonService.java │ │ │ ├── base │ │ │ └── BaseElasticsearchService.java │ │ │ └── impl │ │ │ └── PersonServiceImpl.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── elasticsearch │ └── ElasticsearchApplicationTests.java ├── spring-boot-demo-elasticsearch ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── elasticsearch │ │ │ ├── SpringBootDemoElasticsearchApplication.java │ │ │ ├── constants │ │ │ └── EsConsts.java │ │ │ ├── model │ │ │ └── Person.java │ │ │ └── repository │ │ │ └── PersonRepository.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── elasticsearch │ ├── SpringBootDemoElasticsearchApplicationTests.java │ ├── repository │ └── PersonRepositoryTest.java │ └── template │ └── TemplateTest.java ├── spring-boot-demo-email ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── email │ │ │ ├── SpringBootDemoEmailApplication.java │ │ │ └── service │ │ │ ├── MailService.java │ │ │ └── impl │ │ │ └── MailServiceImpl.java │ └── resources │ │ ├── application.yml │ │ ├── email │ │ └── test.html │ │ ├── static │ │ └── xkcoding.png │ │ └── templates │ │ └── welcome.html │ └── test │ └── java │ └── com │ └── xkcoding │ └── email │ ├── PasswordTest.java │ ├── SpringBootDemoEmailApplicationTests.java │ └── service │ └── MailServiceTest.java ├── spring-boot-demo-exception-handler ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── exception │ │ │ └── handler │ │ │ ├── SpringBootDemoExceptionHandlerApplication.java │ │ │ ├── constant │ │ │ └── Status.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ ├── exception │ │ │ ├── BaseException.java │ │ │ ├── JsonException.java │ │ │ └── PageException.java │ │ │ ├── handler │ │ │ └── DemoExceptionHandler.java │ │ │ └── model │ │ │ └── ApiResponse.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ └── error.html │ └── test │ └── java │ └── com │ └── xkcoding │ └── exception │ └── handler │ └── SpringBootDemoExceptionHandlerApplicationTests.java ├── spring-boot-demo-flyway ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── flyway │ │ │ └── SpringBootDemoFlywayApplication.java │ └── resources │ │ ├── application.yml │ │ └── db │ │ └── migration │ │ ├── V1_0__INIT.sql │ │ └── V1_1__ALTER.sql │ └── test │ └── java │ └── com │ └── xkcoding │ └── AppTest.java ├── spring-boot-demo-graylog ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── graylog │ │ │ └── SpringBootDemoGraylogApplication.java │ └── resources │ │ ├── application.yml │ │ └── logback-spring.xml │ └── test │ └── java │ └── com │ └── xkcoding │ └── graylog │ └── SpringBootDemoGraylogApplicationTests.java ├── spring-boot-demo-helloworld ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── helloworld │ │ │ └── SpringBootDemoHelloworldApplication.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── helloworld │ └── SpringBootDemoHelloworldApplicationTests.java ├── spring-boot-demo-https ├── .gitignore ├── README.md ├── pom.xml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── xkcoding │ │ │ │ └── https │ │ │ │ ├── SpringBootDemoHttpsApplication.java │ │ │ │ └── config │ │ │ │ └── HttpsConfig.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── server.keystore │ │ │ └── static │ │ │ └── index.html │ └── test │ │ └── java │ │ └── com │ │ └── xkcoding │ │ └── https │ │ └── SpringBootDemoHttpsApplicationTests.java └── ssl.png ├── spring-boot-demo-ldap ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── ldap │ │ │ ├── LdapDemoApplication.java │ │ │ ├── api │ │ │ ├── Result.java │ │ │ └── ResultCode.java │ │ │ ├── entity │ │ │ └── Person.java │ │ │ ├── exception │ │ │ └── ServiceException.java │ │ │ ├── repository │ │ │ └── PersonRepository.java │ │ │ ├── request │ │ │ └── LoginRequest.java │ │ │ ├── service │ │ │ ├── PersonService.java │ │ │ └── impl │ │ │ │ └── PersonServiceImpl.java │ │ │ └── util │ │ │ └── LdapUtils.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── ldap │ └── LdapDemoApplicationTests.java ├── spring-boot-demo-log-aop ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── log │ │ │ └── aop │ │ │ ├── SpringBootDemoLogAopApplication.java │ │ │ ├── aspectj │ │ │ └── AopLog.java │ │ │ └── controller │ │ │ └── TestController.java │ └── resources │ │ ├── application.yml │ │ └── logback-spring.xml │ └── test │ └── java │ └── com │ └── xkcoding │ └── log │ └── aop │ └── SpringBootDemoLogAopApplicationTests.java ├── spring-boot-demo-logback ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── logback │ │ │ └── SpringBootDemoLogbackApplication.java │ └── resources │ │ ├── application.yml │ │ └── logback-spring.xml │ └── test │ └── java │ └── com │ └── xkcoding │ └── logback │ └── SpringBootDemoLogbackApplicationTests.java ├── spring-boot-demo-mongodb ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── mongodb │ │ │ ├── SpringBootDemoMongodbApplication.java │ │ │ ├── model │ │ │ └── Article.java │ │ │ └── repository │ │ │ └── ArticleRepository.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── mongodb │ ├── SpringBootDemoMongodbApplicationTests.java │ └── repository │ └── ArticleRepositoryTest.java ├── spring-boot-demo-mq-kafka ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── mq │ │ │ └── kafka │ │ │ ├── SpringBootDemoMqKafkaApplication.java │ │ │ ├── config │ │ │ └── KafkaConfig.java │ │ │ ├── constants │ │ │ └── KafkaConsts.java │ │ │ └── handler │ │ │ └── MessageHandler.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── mq │ └── kafka │ └── SpringBootDemoMqKafkaApplicationTests.java ├── spring-boot-demo-mq-rabbitmq ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── mq │ │ │ └── rabbitmq │ │ │ ├── SpringBootDemoMqRabbitmqApplication.java │ │ │ ├── config │ │ │ └── RabbitMqConfig.java │ │ │ ├── constants │ │ │ └── RabbitConsts.java │ │ │ ├── handler │ │ │ ├── DelayQueueHandler.java │ │ │ ├── DirectQueueOneHandler.java │ │ │ ├── QueueThreeHandler.java │ │ │ └── QueueTwoHandler.java │ │ │ └── message │ │ │ └── MessageStruct.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── mq │ └── rabbitmq │ └── SpringBootDemoMqRabbitmqApplicationTests.java ├── spring-boot-demo-mq-rocketmq ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── mq │ │ │ └── rocketmq │ │ │ └── SpringBootDemoMqRocketmqApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── xkcoding │ └── mq │ └── rocketmq │ └── SpringBootDemoMqRocketmqApplicationTests.java ├── spring-boot-demo-multi-datasource-jpa ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── multi │ │ │ └── datasource │ │ │ └── jpa │ │ │ ├── SpringBootDemoMultiDatasourceJpaApplication.java │ │ │ ├── config │ │ │ ├── PrimaryDataSourceConfig.java │ │ │ ├── PrimaryJpaConfig.java │ │ │ ├── SecondDataSourceConfig.java │ │ │ ├── SecondJpaConfig.java │ │ │ └── SnowflakeConfig.java │ │ │ ├── entity │ │ │ ├── primary │ │ │ │ └── PrimaryMultiTable.java │ │ │ └── second │ │ │ │ └── SecondMultiTable.java │ │ │ └── repository │ │ │ ├── primary │ │ │ └── PrimaryMultiTableRepository.java │ │ │ └── second │ │ │ └── SecondMultiTableRepository.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── multi │ └── datasource │ └── jpa │ └── SpringBootDemoMultiDatasourceJpaApplicationTests.java ├── spring-boot-demo-multi-datasource-mybatis ├── .gitignore ├── README.md ├── pom.xml ├── sql │ └── db.sql └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── multi │ │ │ └── datasource │ │ │ └── mybatis │ │ │ ├── SpringBootDemoMultiDatasourceMybatisApplication.java │ │ │ ├── mapper │ │ │ └── UserMapper.java │ │ │ ├── model │ │ │ └── User.java │ │ │ └── service │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ └── UserServiceImpl.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── multi │ └── datasource │ └── mybatis │ ├── SpringBootDemoMultiDatasourceMybatisApplicationTests.java │ └── service │ └── impl │ └── UserServiceImplTest.java ├── spring-boot-demo-neo4j ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── neo4j │ │ │ ├── SpringBootDemoNeo4jApplication.java │ │ │ ├── config │ │ │ └── CustomIdStrategy.java │ │ │ ├── constants │ │ │ └── NeoConsts.java │ │ │ ├── model │ │ │ ├── Class.java │ │ │ ├── Lesson.java │ │ │ ├── Student.java │ │ │ └── Teacher.java │ │ │ ├── payload │ │ │ ├── ClassmateInfoGroupByLesson.java │ │ │ └── TeacherStudent.java │ │ │ ├── repository │ │ │ ├── ClassRepository.java │ │ │ ├── LessonRepository.java │ │ │ ├── StudentRepository.java │ │ │ └── TeacherRepository.java │ │ │ └── service │ │ │ └── NeoService.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── neo4j │ ├── Neo4jTest.java │ └── SpringBootDemoNeo4jApplicationTests.java ├── spring-boot-demo-oauth ├── .gitignore ├── README.md ├── pom.xml ├── spring-boot-demo-oauth-authorization-server │ ├── README.adoc │ ├── image │ │ ├── Code.png │ │ ├── Confirm.png │ │ ├── Login.png │ │ └── Logout.png │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── xkcoding │ │ │ │ └── oauth │ │ │ │ ├── SpringBootDemoOauthApplication.java │ │ │ │ ├── config │ │ │ │ ├── ClientLoginFailureHandler.java │ │ │ │ ├── ClientLogoutSuccessHandler.java │ │ │ │ ├── Oauth2AuthorizationServerConfig.java │ │ │ │ ├── Oauth2AuthorizationTokenConfig.java │ │ │ │ ├── WebSecurityConfig.java │ │ │ │ └── package-info.java │ │ │ │ ├── controller │ │ │ │ ├── AuthorizationController.java │ │ │ │ ├── Oauth2Controller.java │ │ │ │ └── package-info.java │ │ │ │ ├── entity │ │ │ │ ├── SysClientDetails.java │ │ │ │ ├── SysRole.java │ │ │ │ └── SysUser.java │ │ │ │ ├── repostiory │ │ │ │ ├── SysClientDetailsRepository.java │ │ │ │ └── SysUserRepository.java │ │ │ │ └── service │ │ │ │ ├── SysClientDetailsService.java │ │ │ │ ├── SysUserService.java │ │ │ │ ├── impl │ │ │ │ ├── SysClientDetailsServiceImpl.java │ │ │ │ └── SysUserServiceImpl.java │ │ │ │ └── package-info.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── oauth2.jks │ │ │ ├── public.txt │ │ │ └── templates │ │ │ ├── authorization.html │ │ │ ├── common │ │ │ └── common.html │ │ │ ├── error.html │ │ │ ├── login.html │ │ │ ├── logout.html │ │ │ └── registerTemplate.html │ │ └── test │ │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── oauth │ │ │ ├── PasswordEncodeTest.java │ │ │ ├── oauth │ │ │ ├── AuthorizationCodeGrantTests.java │ │ │ ├── AuthorizationServerInfo.java │ │ │ └── ResourceOwnerPasswordGrantTests.java │ │ │ └── repostiory │ │ │ ├── SysClientDetailsTest.java │ │ │ └── SysUserRepositoryTest.java │ │ └── resources │ │ ├── application.yml │ │ ├── import.sql │ │ └── schema.sql └── spring-boot-demo-oauth-resource-server │ ├── README.adoc │ ├── pom.xml │ └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── oauth │ │ │ ├── SpringBootDemoResourceApplication.java │ │ │ ├── config │ │ │ ├── OauthResourceServerConfig.java │ │ │ └── OauthResourceTokenConfig.java │ │ │ └── controller │ │ │ └── TestController.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── oauth │ ├── AuthorizationTest.java │ └── controller │ └── TestControllerTest.java ├── spring-boot-demo-orm-beetlsql ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── orm │ │ │ └── beetlsql │ │ │ ├── SpringBootDemoOrmBeetlsqlApplication.java │ │ │ ├── config │ │ │ └── BeetlConfig.java │ │ │ ├── dao │ │ │ └── UserDao.java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── service │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ └── UserServiceImpl.java │ └── resources │ │ ├── application.yml │ │ └── db │ │ ├── data.sql │ │ └── schema.sql │ └── test │ └── java │ └── com │ └── xkcoding │ └── orm │ └── beetlsql │ ├── SpringBootDemoOrmBeetlsqlApplicationTests.java │ └── service │ └── UserServiceTest.java ├── spring-boot-demo-orm-jdbctemplate ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── orm │ │ │ └── jdbctemplate │ │ │ ├── SpringBootDemoOrmJdbctemplateApplication.java │ │ │ ├── annotation │ │ │ ├── Column.java │ │ │ ├── Ignore.java │ │ │ ├── Pk.java │ │ │ └── Table.java │ │ │ ├── constant │ │ │ └── Const.java │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ ├── dao │ │ │ ├── UserDao.java │ │ │ └── base │ │ │ │ └── BaseDao.java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── service │ │ │ ├── IUserService.java │ │ │ └── impl │ │ │ └── UserServiceImpl.java │ └── resources │ │ ├── application.yml │ │ └── db │ │ ├── data.sql │ │ └── schema.sql │ └── test │ └── java │ └── com │ └── xkcoding │ └── orm │ └── jdbctemplate │ └── SpringBootDemoOrmJdbctemplateApplicationTests.java ├── spring-boot-demo-orm-jpa ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── orm │ │ │ └── jpa │ │ │ ├── SpringBootDemoOrmJpaApplication.java │ │ │ ├── config │ │ │ └── JpaConfig.java │ │ │ ├── entity │ │ │ ├── Department.java │ │ │ ├── User.java │ │ │ └── base │ │ │ │ └── AbstractAuditModel.java │ │ │ └── repository │ │ │ ├── DepartmentDao.java │ │ │ └── UserDao.java │ └── resources │ │ ├── application.yml │ │ └── db │ │ ├── data.sql │ │ └── schema.sql │ └── test │ └── java │ └── com │ └── xkcoding │ └── orm │ └── jpa │ ├── SpringBootDemoOrmJpaApplicationTests.java │ └── repository │ ├── DepartmentDaoTest.java │ └── UserDaoTest.java ├── spring-boot-demo-orm-mybatis-mapper-page ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── orm │ │ │ └── mybatis │ │ │ └── MapperAndPage │ │ │ ├── SpringBootDemoOrmMybatisMapperPageApplication.java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── mapper │ │ │ └── UserMapper.java │ └── resources │ │ ├── application.yml │ │ └── db │ │ ├── data.sql │ │ └── schema.sql │ └── test │ └── java │ └── com │ └── xkcoding │ └── orm │ └── mybatis │ └── MapperAndPage │ ├── SpringBootDemoOrmMybatisMapperPageApplicationTests.java │ └── mapper │ └── UserMapperTest.java ├── spring-boot-demo-orm-mybatis-plus ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── orm │ │ │ └── mybatis │ │ │ └── plus │ │ │ ├── SpringBootDemoOrmMybatisPlusApplication.java │ │ │ ├── config │ │ │ ├── CommonFieldHandler.java │ │ │ └── MybatisPlusConfig.java │ │ │ ├── entity │ │ │ ├── Role.java │ │ │ └── User.java │ │ │ ├── mapper │ │ │ ├── RoleMapper.java │ │ │ └── UserMapper.java │ │ │ └── service │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ └── UserServiceImpl.java │ └── resources │ │ ├── application.yml │ │ └── db │ │ ├── data.sql │ │ └── schema.sql │ └── test │ └── java │ └── com │ └── xkcoding │ └── orm │ └── mybatis │ └── plus │ ├── SpringBootDemoOrmMybatisPlusApplicationTests.java │ ├── activerecord │ └── ActiveRecordTest.java │ └── service │ └── UserServiceTest.java ├── spring-boot-demo-orm-mybatis ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── orm │ │ │ └── mybatis │ │ │ ├── SpringBootDemoOrmMybatisApplication.java │ │ │ ├── entity │ │ │ └── User.java │ │ │ └── mapper │ │ │ └── UserMapper.java │ └── resources │ │ ├── application.yml │ │ ├── db │ │ ├── data.sql │ │ └── schema.sql │ │ └── mappers │ │ └── UserMapper.xml │ └── test │ └── java │ └── com │ └── xkcoding │ └── orm │ └── mybatis │ ├── SpringBootDemoOrmMybatisApplicationTests.java │ └── mapper │ └── UserMapperTest.java ├── spring-boot-demo-properties ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── properties │ │ │ ├── SpringBootDemoPropertiesApplication.java │ │ │ ├── controller │ │ │ └── PropertyController.java │ │ │ └── property │ │ │ ├── ApplicationProperty.java │ │ │ └── DeveloperProperty.java │ └── resources │ │ ├── META-INF │ │ └── additional-spring-configuration-metadata.json │ │ ├── application-dev.yml │ │ ├── application-prod.yml │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── properties │ └── SpringBootDemoPropertiesApplicationTests.java ├── spring-boot-demo-ratelimit-guava ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── ratelimit │ │ │ └── guava │ │ │ ├── SpringBootDemoRatelimitGuavaApplication.java │ │ │ ├── annotation │ │ │ └── RateLimiter.java │ │ │ ├── aspect │ │ │ └── RateLimiterAspect.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ └── handler │ │ │ └── GlobalExceptionHandler.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── ratelimit │ └── guava │ └── SpringBootDemoRatelimitGuavaApplicationTests.java ├── spring-boot-demo-ratelimit-redis ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── ratelimit │ │ │ └── redis │ │ │ ├── SpringBootDemoRatelimitRedisApplication.java │ │ │ ├── annotation │ │ │ └── RateLimiter.java │ │ │ ├── aspect │ │ │ └── RateLimiterAspect.java │ │ │ ├── config │ │ │ └── RedisConfig.java │ │ │ ├── controller │ │ │ └── TestController.java │ │ │ ├── handler │ │ │ └── GlobalExceptionHandler.java │ │ │ └── util │ │ │ └── IpUtil.java │ └── resources │ │ ├── application.yml │ │ └── scripts │ │ └── redis │ │ └── limit.lua │ └── test │ └── java │ └── com │ └── xkcoding │ └── ratelimit │ └── redis │ └── SpringBootDemoRatelimiterRedisApplicationTests.java ├── spring-boot-demo-rbac-security ├── .gitignore ├── README.md ├── pom.xml ├── sql │ └── security.sql └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── rbac │ │ │ └── security │ │ │ ├── SpringBootDemoRbacSecurityApplication.java │ │ │ ├── common │ │ │ ├── ApiResponse.java │ │ │ ├── BaseException.java │ │ │ ├── Consts.java │ │ │ ├── IStatus.java │ │ │ ├── PageResult.java │ │ │ └── Status.java │ │ │ ├── config │ │ │ ├── CustomConfig.java │ │ │ ├── IdConfig.java │ │ │ ├── IgnoreConfig.java │ │ │ ├── JwtAuthenticationFilter.java │ │ │ ├── JwtConfig.java │ │ │ ├── RbacAuthorityService.java │ │ │ ├── RedisConfig.java │ │ │ ├── SecurityConfig.java │ │ │ ├── SecurityHandlerConfig.java │ │ │ └── WebMvcConfig.java │ │ │ ├── controller │ │ │ ├── AuthController.java │ │ │ ├── MonitorController.java │ │ │ └── TestController.java │ │ │ ├── exception │ │ │ ├── SecurityException.java │ │ │ └── handler │ │ │ │ └── GlobalExceptionHandler.java │ │ │ ├── model │ │ │ ├── Permission.java │ │ │ ├── Role.java │ │ │ ├── RolePermission.java │ │ │ ├── User.java │ │ │ ├── UserRole.java │ │ │ └── unionkey │ │ │ │ ├── RolePermissionKey.java │ │ │ │ └── UserRoleKey.java │ │ │ ├── payload │ │ │ ├── LoginRequest.java │ │ │ └── PageCondition.java │ │ │ ├── repository │ │ │ ├── PermissionDao.java │ │ │ ├── RoleDao.java │ │ │ ├── RolePermissionDao.java │ │ │ ├── UserDao.java │ │ │ └── UserRoleDao.java │ │ │ ├── service │ │ │ ├── CustomUserDetailsService.java │ │ │ └── MonitorService.java │ │ │ ├── util │ │ │ ├── JwtUtil.java │ │ │ ├── PageUtil.java │ │ │ ├── RedisUtil.java │ │ │ ├── ResponseUtil.java │ │ │ └── SecurityUtil.java │ │ │ └── vo │ │ │ ├── JwtResponse.java │ │ │ ├── OnlineUser.java │ │ │ └── UserPrincipal.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── rbac │ └── security │ ├── SpringBootDemoRbacSecurityApplicationTests.java │ ├── repository │ ├── DataInitTest.java │ └── UserDaoTest.java │ └── util │ └── RedisUtilTest.java ├── spring-boot-demo-rbac-shiro ├── .gitignore ├── pom.xml ├── sql │ └── shiro.sql └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── rbac │ │ │ └── shiro │ │ │ ├── SpringBootDemoRbacShiroApplication.java │ │ │ ├── common │ │ │ ├── IResultCode.java │ │ │ ├── R.java │ │ │ └── ResultCode.java │ │ │ ├── config │ │ │ └── MybatisPlusConfig.java │ │ │ └── controller │ │ │ └── TestController.java │ └── resources │ │ ├── application.yml │ │ └── spy.properties │ └── test │ └── java │ └── com │ └── xkcoding │ └── rbac │ └── shiro │ └── SpringBootDemoRbacShiroApplicationTests.java ├── spring-boot-demo-session ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── session │ │ │ ├── SpringBootDemoSessionApplication.java │ │ │ ├── config │ │ │ └── WebMvcConfig.java │ │ │ ├── constants │ │ │ └── Consts.java │ │ │ ├── controller │ │ │ └── PageController.java │ │ │ └── interceptor │ │ │ └── SessionInterceptor.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ ├── index.html │ │ └── login.html │ └── test │ └── java │ └── com │ └── xkcoding │ └── session │ └── SpringBootDemoSessionApplicationTests.java ├── spring-boot-demo-sharding-jdbc ├── .gitignore ├── README.md ├── pom.xml ├── sql │ └── schema.sql └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── sharding │ │ │ └── jdbc │ │ │ ├── SpringBootDemoShardingJdbcApplication.java │ │ │ ├── config │ │ │ ├── CustomSnowflakeKeyGenerator.java │ │ │ └── DataSourceShardingConfig.java │ │ │ ├── mapper │ │ │ └── OrderMapper.java │ │ │ └── model │ │ │ └── Order.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── sharding │ └── jdbc │ └── SpringBootDemoShardingJdbcApplicationTests.java ├── spring-boot-demo-social ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── social │ │ │ ├── SpringBootDemoSocialApplication.java │ │ │ └── controller │ │ │ └── OauthController.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── social │ └── SpringBootDemoSocialApplicationTests.java ├── spring-boot-demo-swagger-beauty ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── swagger │ │ │ └── beauty │ │ │ ├── SpringBootDemoSwaggerBeautyApplication.java │ │ │ ├── common │ │ │ └── ApiResponse.java │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ └── entity │ │ │ └── User.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── swagger │ └── beauty │ └── SpringBootDemoSwaggerBeautyApplicationTests.java ├── spring-boot-demo-swagger ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── swagger │ │ │ ├── SpringBootDemoSwaggerApplication.java │ │ │ ├── common │ │ │ ├── ApiResponse.java │ │ │ ├── DataType.java │ │ │ └── ParamType.java │ │ │ ├── config │ │ │ └── Swagger2Config.java │ │ │ ├── controller │ │ │ └── UserController.java │ │ │ └── entity │ │ │ └── User.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── swagger │ └── SpringBootDemoSwaggerApplicationTests.java ├── spring-boot-demo-task-quartz ├── .gitignore ├── README.md ├── init │ └── dbTables │ │ ├── tables_cloudscape.sql │ │ ├── tables_cubrid.sql │ │ ├── tables_db2.sql │ │ ├── tables_db2_v72.sql │ │ ├── tables_db2_v8.sql │ │ ├── tables_db2_v95.sql │ │ ├── tables_derby.sql │ │ ├── tables_derby_previous.sql │ │ ├── tables_firebird.sql │ │ ├── tables_h2.sql │ │ ├── tables_hsqldb.sql │ │ ├── tables_hsqldb_old.sql │ │ ├── tables_informix.sql │ │ ├── tables_mysql.sql │ │ ├── tables_mysql_innodb.sql │ │ ├── tables_oracle.sql │ │ ├── tables_pointbase.sql │ │ ├── tables_postgres.sql │ │ ├── tables_sapdb.sql │ │ ├── tables_solid.sql │ │ ├── tables_sqlServer.sql │ │ └── tables_sybase.sql ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── task │ │ │ └── quartz │ │ │ ├── SpringBootDemoTaskQuartzApplication.java │ │ │ ├── common │ │ │ └── ApiResponse.java │ │ │ ├── controller │ │ │ └── JobController.java │ │ │ ├── entity │ │ │ ├── domain │ │ │ │ └── JobAndTrigger.java │ │ │ └── form │ │ │ │ └── JobForm.java │ │ │ ├── job │ │ │ ├── HelloJob.java │ │ │ ├── TestJob.java │ │ │ └── base │ │ │ │ └── BaseJob.java │ │ │ ├── mapper │ │ │ └── JobMapper.java │ │ │ ├── service │ │ │ ├── JobService.java │ │ │ └── impl │ │ │ │ └── JobServiceImpl.java │ │ │ └── util │ │ │ └── JobUtil.java │ └── resources │ │ ├── application.yml │ │ ├── mappers │ │ └── JobMapper.xml │ │ └── static │ │ └── job.html │ └── test │ └── java │ └── com │ └── xkcoding │ └── task │ └── quartz │ └── SpringBootDemoTaskQuartzApplicationTests.java ├── spring-boot-demo-task-xxl-job ├── .gitignore ├── README.md ├── pom.xml └── src │ └── main │ ├── java │ └── com │ │ └── xkcoding │ │ └── task │ │ └── xxl │ │ └── job │ │ ├── SpringBootDemoTaskXxlJobApplication.java │ │ ├── config │ │ ├── XxlJobConfig.java │ │ └── props │ │ │ └── XxlJobProps.java │ │ ├── controller │ │ └── ManualOperateController.java │ │ └── task │ │ └── DemoTask.java │ └── resources │ └── application.yml ├── spring-boot-demo-task ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── task │ │ │ ├── SpringBootDemoTaskApplication.java │ │ │ ├── config │ │ │ └── TaskConfig.java │ │ │ └── job │ │ │ └── TaskJob.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── task │ └── SpringBootDemoTaskApplicationTests.java ├── spring-boot-demo-template-beetl ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── template │ │ │ └── beetl │ │ │ ├── SpringBootDemoTemplateBeetlApplication.java │ │ │ ├── controller │ │ │ ├── IndexController.java │ │ │ └── UserController.java │ │ │ └── model │ │ │ └── User.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ ├── common │ │ └── head.html │ │ └── page │ │ ├── index.btl │ │ └── login.btl │ └── test │ └── java │ └── com │ └── xkcoding │ └── template │ └── beetl │ └── SpringBootDemoTemplateBeetlApplicationTests.java ├── spring-boot-demo-template-enjoy ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── template │ │ │ └── enjoy │ │ │ ├── SpringBootDemoTemplateEnjoyApplication.java │ │ │ ├── config │ │ │ └── EnjoyConfig.java │ │ │ ├── controller │ │ │ ├── IndexController.java │ │ │ └── UserController.java │ │ │ └── model │ │ │ └── User.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ ├── common │ │ └── head.html │ │ └── page │ │ ├── index.html │ │ └── login.html │ └── test │ └── java │ └── com │ └── xkcoding │ └── template │ └── enjoy │ └── SpringBootDemoTemplateEnjoyApplicationTests.java ├── spring-boot-demo-template-freemarker ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── template │ │ │ └── freemarker │ │ │ ├── SpringBootDemoTemplateFreemarkerApplication.java │ │ │ ├── controller │ │ │ ├── IndexController.java │ │ │ └── UserController.java │ │ │ └── model │ │ │ └── User.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ ├── common │ │ └── head.ftl │ │ └── page │ │ ├── index.ftl │ │ └── login.ftl │ └── test │ └── java │ └── com │ └── xkcoding │ └── template │ └── freemarker │ └── SpringBootDemoTemplateFreemarkerApplicationTests.java ├── spring-boot-demo-template-thymeleaf ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── template │ │ │ └── thymeleaf │ │ │ ├── SpringBootDemoTemplateThymeleafApplication.java │ │ │ ├── controller │ │ │ ├── IndexController.java │ │ │ └── UserController.java │ │ │ └── model │ │ │ └── User.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ ├── common │ │ └── head.html │ │ └── page │ │ ├── index.html │ │ └── login.html │ └── test │ └── java │ └── com │ └── xkcoding │ └── template │ └── thymeleaf │ └── SpringBootDemoTemplateThymeleafApplicationTests.java ├── spring-boot-demo-tio ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── springbootdemotio │ │ │ └── SpringBootDemoTioApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── xkcoding │ └── springbootdemotio │ └── SpringBootDemoTioApplicationTests.java ├── spring-boot-demo-uflo ├── .gitignore ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── uflo │ │ │ └── SpringBootDemoUfloApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── xkcoding │ └── uflo │ └── SpringBootDemoUfloApplicationTests.java ├── spring-boot-demo-upload ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── upload │ │ │ ├── SpringBootDemoUploadApplication.java │ │ │ ├── config │ │ │ └── UploadConfig.java │ │ │ ├── controller │ │ │ ├── IndexController.java │ │ │ └── UploadController.java │ │ │ └── service │ │ │ ├── IQiNiuService.java │ │ │ └── impl │ │ │ └── QiNiuServiceImpl.java │ └── resources │ │ ├── application.yml │ │ └── templates │ │ └── index.html │ └── test │ └── java │ └── com │ └── xkcoding │ └── upload │ └── SpringBootDemoUploadApplicationTests.java ├── spring-boot-demo-ureport2 ├── .gitignore ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── ureport2 │ │ │ └── SpringBootDemoUreport2Application.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── xkcoding │ └── ureport2 │ └── SpringBootDemoUreport2ApplicationTests.java ├── spring-boot-demo-urule ├── .gitignore ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── urule │ │ │ └── SpringBootDemoUruleApplication.java │ └── resources │ │ └── application.properties │ └── test │ └── java │ └── com │ └── xkcoding │ └── urule │ └── SpringBootDemoUruleApplicationTests.java ├── spring-boot-demo-war ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── war │ │ │ └── SpringBootDemoWarApplication.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── xkcoding │ └── war │ └── SpringBootDemoWarApplicationTests.java ├── spring-boot-demo-websocket-socketio ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── websocket │ │ │ └── socketio │ │ │ ├── SpringBootDemoWebsocketSocketioApplication.java │ │ │ ├── config │ │ │ ├── DbTemplate.java │ │ │ ├── Event.java │ │ │ ├── ServerConfig.java │ │ │ └── WsConfig.java │ │ │ ├── controller │ │ │ └── MessageController.java │ │ │ ├── handler │ │ │ └── MessageEventHandler.java │ │ │ ├── init │ │ │ └── ServerRunner.java │ │ │ └── payload │ │ │ ├── BroadcastMessageRequest.java │ │ │ ├── GroupMessageRequest.java │ │ │ ├── JoinRequest.java │ │ │ └── SingleMessageRequest.java │ └── resources │ │ ├── application.yml │ │ └── static │ │ ├── bootstrap.css │ │ ├── index.html │ │ └── js │ │ ├── jquery-1.10.1.min.js │ │ ├── moment.min.js │ │ └── socket.io │ │ └── socket.io.js │ └── test │ └── java │ └── com │ └── xkcoding │ └── websocket │ └── socketio │ └── SpringBootDemoWebsocketSocketioApplicationTests.java ├── spring-boot-demo-websocket ├── .gitignore ├── README.md ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── xkcoding │ │ │ └── websocket │ │ │ ├── SpringBootDemoWebsocketApplication.java │ │ │ ├── common │ │ │ └── WebSocketConsts.java │ │ │ ├── config │ │ │ └── WebSocketConfig.java │ │ │ ├── controller │ │ │ └── ServerController.java │ │ │ ├── model │ │ │ ├── Server.java │ │ │ └── server │ │ │ │ ├── Cpu.java │ │ │ │ ├── Jvm.java │ │ │ │ ├── Mem.java │ │ │ │ ├── Sys.java │ │ │ │ └── SysFile.java │ │ │ ├── payload │ │ │ ├── KV.java │ │ │ ├── ServerVO.java │ │ │ └── server │ │ │ │ ├── CpuVO.java │ │ │ │ ├── JvmVO.java │ │ │ │ ├── MemVO.java │ │ │ │ ├── SysFileVO.java │ │ │ │ └── SysVO.java │ │ │ ├── task │ │ │ └── ServerTask.java │ │ │ └── util │ │ │ ├── IpUtil.java │ │ │ └── ServerUtil.java │ └── resources │ │ ├── application.yml │ │ └── static │ │ ├── js │ │ ├── sockjs.min.js │ │ └── stomp.js │ │ └── server.html │ └── test │ └── java │ └── com │ └── xkcoding │ └── websocket │ └── SpringBootDemoWebsocketApplicationTests.java └── spring-boot-demo-zookeeper ├── .gitignore ├── README.md ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── xkcoding │ │ └── zookeeper │ │ ├── SpringBootDemoZookeeperApplication.java │ │ ├── annotation │ │ ├── LockKeyParam.java │ │ └── ZooLock.java │ │ ├── aspectj │ │ └── ZooLockAspect.java │ │ └── config │ │ ├── ZkConfig.java │ │ └── props │ │ └── ZkProps.java └── resources │ └── application.yml └── test └── java └── com └── xkcoding └── zookeeper └── SpringBootDemoZookeeperApplicationTests.java /.codacy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | exclude_paths: 3 | - '**.md' 4 | - '**/**.md' 5 | - '**.sql' 6 | - '**.html' 7 | - '**/static/**' 8 | - '**/templates/**' 9 | - '**/test/**' 10 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # 开发组IDE 编辑器标准 2 | root = true 3 | 4 | [*] 5 | indent_size = 2 6 | charset = utf-8 7 | indent_style = space 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.{groovy, java, kt, kts, xsd}] 13 | indent_size = 4 14 | -------------------------------------------------------------------------------- /.gitee/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 报告缺陷 3 | about: 报告缺陷以帮助我们改进 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: xkcoding 7 | --- 8 | 9 | **请先看[《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md?utm_source=hacpai.com)**,并尝试到 **[issue 列表](https://github.com/xkcoding/spring-boot-demo/issues)** 搜寻是否已经有人遇到过同样的问题。 10 | 11 | ---- 12 | 13 | ### 描述问题 14 | 15 | 请尽量清晰精准地描述你碰到的问题。 16 | 17 | ```bash 18 | 日志内容 19 | ``` 20 | 21 | ### 期待的结果 22 | 23 | 请尽量清晰精准地描述你所期待的结果。 24 | 25 | ### 截屏或录像 26 | 27 | 如果可能,请尽量附加截图或录像来描述你遇到的问题。 28 | 29 | ### 其他信息 30 | 31 | 请提供其他附加信息帮助我们诊断问题。 32 | -------------------------------------------------------------------------------- /.gitee/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 请求新功能 3 | about: 提出你期待的功能特性 4 | title: "[FEATURE]" 5 | labels: feature 6 | assignees: xkcoding 7 | --- 8 | 9 | ### 你在什么场景下需要该功能? 10 | 11 | 请尽量清晰精准地描述你碰到的问题。 12 | 13 | ### 描述可能的解决方案 14 | 15 | 请尽量清晰精准地描述你期待我们要做的,描述你想到的实现方案。 16 | 17 | ### 描述你认为的候选方案 18 | 19 | 请尽量清晰精准地描述你能接受的候选解决方案。 20 | 21 | ### 其他信息 22 | 23 | 请提供关于该功能建议的其他附加信息。 24 | -------------------------------------------------------------------------------- /.gitee/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * PR 修复缺陷请先开 `issue` **[报告缺陷](https://github.com/xkcoding/spring-boot-demo/issues/new?template=bug_report.md)** 2 | * PR 提交新特性请先开 `issue` **[报告新特性](https://github.com/xkcoding/spring-boot-demo/issues/new?template=feature_request.md)** 3 | * PR 请提交到 `dev` 开发分支上 4 | * 我们对编码风格有着较为严格的要求,请在阅读代码后模仿类似风格提交 5 | * 欢迎通过 PR 给我们补充案例 6 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: https://docs.xkcoding.com/SPONSER.html 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 报告缺陷 3 | about: 报告缺陷以帮助我们改进 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: xkcoding 7 | --- 8 | 9 | **请先看[《提问的智慧》](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/master/README-zh_CN.md?utm_source=hacpai.com)**,并尝试到 **[issue 列表](https://github.com/xkcoding/spring-boot-demo/issues)** 搜寻是否已经有人遇到过同样的问题。 10 | 11 | ---- 12 | 13 | ### 描述问题 14 | 15 | 请尽量清晰精准地描述你碰到的问题。 16 | 17 | ```bash 18 | 日志内容 19 | ``` 20 | 21 | ### 期待的结果 22 | 23 | 请尽量清晰精准地描述你所期待的结果。 24 | 25 | ### 截屏或录像 26 | 27 | 如果可能,请尽量附加截图或录像来描述你遇到的问题。 28 | 29 | ### 其他信息 30 | 31 | 请提供其他附加信息帮助我们诊断问题。 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 请求新功能 3 | about: 提出你期待的功能特性 4 | title: "[FEATURE]" 5 | labels: feature 6 | assignees: xkcoding 7 | --- 8 | 9 | ### 你在什么场景下需要该功能? 10 | 11 | 请尽量清晰精准地描述你碰到的问题。 12 | 13 | ### 描述可能的解决方案 14 | 15 | 请尽量清晰精准地描述你期待我们要做的,描述你想到的实现方案。 16 | 17 | ### 描述你认为的候选方案 18 | 19 | 请尽量清晰精准地描述你能接受的候选解决方案。 20 | 21 | ### 其他信息 22 | 23 | 请提供关于该功能建议的其他附加信息。 24 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | * PR 修复缺陷请先开 `issue` **[报告缺陷](https://github.com/xkcoding/spring-boot-demo/issues/new?template=bug_report.md)** 2 | * PR 提交新特性请先开 `issue` **[报告新特性](https://github.com/xkcoding/spring-boot-demo/issues/new?template=feature_request.md)** 3 | * PR 请提交到 `dev` 开发分支上 4 | * 我们对编码风格有着较为严格的要求,请在阅读代码后模仿类似风格提交 5 | * 欢迎通过 PR 给我们补充案例 6 | -------------------------------------------------------------------------------- /.github/workflows/maven.yml: -------------------------------------------------------------------------------- 1 | name: GitHub CI 2 | on: 3 | push: 4 | branches: 5 | - master 6 | pull_request: 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v1 12 | - name: Set up JDK 1.8 13 | uses: actions/setup-java@v1 14 | with: 15 | java-version: 1.8 16 | - name: Build with Maven 17 | run: mvn clean package -DskipTests=true -Dmaven.javadoc.skip=true -B -V 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### xkcoding-后端 template 3 | ### Spring Boot ### 4 | target/ 5 | !.mvn/wrapper/maven-wrapper.jar 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 | out/ 22 | gen/ 23 | 24 | ### NetBeans ### 25 | /nbproject/private/ 26 | /build/ 27 | /nbbuild/ 28 | /dist/ 29 | /nbdist/ 30 | /.nb-gradle/ 31 | 32 | ### LOGS ### 33 | logs/ 34 | *.log 35 | 36 | ### Mac OS ### 37 | .DS_Store 38 | 39 | ### VS CODE ### 40 | .vscode/ 41 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # 语言 2 | language: java 3 | # 执行脚本 4 | script: "mvn clean package -DskipTests=true -Dmaven.javadoc.skip=true -B -V" 5 | # 通知 6 | notifications: 7 | email: 8 | recipients: 9 | - 237497819@qq.com 10 | on_success: always # default: change 11 | on_failure: always # default: always 12 | # 缓存 13 | cache: 14 | directories: 15 | - '$HOME/.m2/repository' 16 | 17 | branches: 18 | only: 19 | - master 20 | -------------------------------------------------------------------------------- /spring-boot-demo-activiti/.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 | .sts4-cache 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-demo-activiti/src/main/java/com/xkcoding/activiti/SpringBootDemoActivitiApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.activiti; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.activiti 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-03-31 22:24 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoActivitiApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoActivitiApplication.class, args); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /spring-boot-demo-activiti/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | url: jdbc:mysql://localhost:3306/spring-boot-demo 4 | username: root 5 | password: root 6 | hikari: 7 | data-source-properties: 8 | useSSL: false 9 | serverTimezone: GMT+8 10 | useUnicode: true 11 | characterEncoding: utf8 12 | # 这个必须要加,否则 Activiti 自动建表会失败 13 | nullCatalogMeansCurrent: true 14 | activiti: 15 | history-level: full 16 | db-history-used: true -------------------------------------------------------------------------------- /spring-boot-demo-actuator/.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 | .sts4-cache 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-demo-actuator/src/main/java/com/xkcoding/actuator/SpringBootDemoActuatorApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.actuator; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.actuator 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/9/29 2:27 PM 15 | * @copyright: Copyright (c)2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoActuatorApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoActuatorApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-actuator/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | # 若要访问端点信息,需要配置用户名和密码 6 | spring: 7 | security: 8 | user: 9 | name: xkcoding 10 | password: 123456 11 | management: 12 | # 端点信息接口使用的端口,为了和主系统接口使用的端口进行分离 13 | server: 14 | port: 8090 15 | servlet: 16 | context-path: /sys 17 | # 端点健康情况,默认值"never",设置为"always"可以显示硬盘使用情况和线程情况 18 | endpoint: 19 | health: 20 | show-details: always 21 | # 设置端点暴露的哪些内容,默认["health","info"],设置"*"代表暴露所有可访问的端点 22 | endpoints: 23 | web: 24 | exposure: 25 | include: '*' -------------------------------------------------------------------------------- /spring-boot-demo-actuator/src/test/java/com/xkcoding/actuator/SpringBootDemoActuatorApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.actuator; 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 SpringBootDemoActuatorApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-admin/spring-boot-demo-admin-client/.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 | .sts4-cache 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-demo-admin/spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.admin.client; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.admin.client 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/8 2:16 PM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoAdminClientApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoAdminClientApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-admin/spring-boot-demo-admin-client/src/main/java/com/xkcoding/admin/client/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.admin.client.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | *

8 | * 首页 9 | *

10 | * 11 | * @package: com.xkcoding.admin.client.controller 12 | * @description: 首页 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/8 2:15 PM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @RestController 20 | public class IndexController { 21 | @GetMapping(value = {"", "/"}) 22 | public String index() { 23 | return "This is a Spring Boot Admin Client."; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-admin/spring-boot-demo-admin-client/src/test/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.admin.client; 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 SpringBootDemoAdminClientApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-admin/spring-boot-demo-admin-server/.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 | .sts4-cache 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-demo-admin/spring-boot-demo-admin-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8000 3 | -------------------------------------------------------------------------------- /spring-boot-demo-admin/spring-boot-demo-admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.admin.server; 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 SpringBootDemoAdminServerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-async/.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 | .sts4-cache 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-demo-async/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | task: 3 | execution: 4 | pool: 5 | # 最大线程数 6 | max-size: 16 7 | # 核心线程数 8 | core-size: 16 9 | # 存活时间 10 | keep-alive: 10s 11 | # 队列大小 12 | queue-capacity: 100 13 | # 是否允许核心线程超时 14 | allow-core-thread-timeout: true 15 | # 线程名称前缀 16 | thread-name-prefix: async-task- -------------------------------------------------------------------------------- /spring-boot-demo-async/src/test/java/com/xkcoding/async/SpringBootDemoAsyncApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.async; 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 SpringBootDemoAsyncApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-cache-ehcache/.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 | .sts4-cache 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-demo-cache-ehcache/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | cache: 3 | type: ehcache 4 | ehcache: 5 | config: classpath:ehcache.xml 6 | logging: 7 | level: 8 | com.xkcoding: debug -------------------------------------------------------------------------------- /spring-boot-demo-cache-ehcache/src/test/java/com/xkcoding/cache/ehcache/SpringBootDemoCacheEhcacheApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.cache.ehcache; 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 SpringBootDemoCacheEhcacheApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-cache-redis/.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 | .sts4-cache 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-demo-cache-redis/src/main/java/com/xkcoding/cache/redis/SpringBootDemoCacheRedisApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.cache.redis; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootDemoCacheRedisApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootDemoCacheRedisApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /spring-boot-demo-cache-redis/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | redis: 3 | host: localhost 4 | # 连接超时时间(记得添加单位,Duration) 5 | timeout: 10000ms 6 | # Redis默认情况下有16个分片,这里配置具体使用的分片 7 | # database: 0 8 | lettuce: 9 | pool: 10 | # 连接池最大连接数(使用负值表示没有限制) 默认 8 11 | max-active: 8 12 | # 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1 13 | max-wait: -1ms 14 | # 连接池中的最大空闲连接 默认 8 15 | max-idle: 8 16 | # 连接池中的最小空闲连接 默认 0 17 | min-idle: 0 18 | cache: 19 | # 一般来说是不用配置的,Spring Cache 会根据依赖的包自行装配 20 | type: redis 21 | logging: 22 | level: 23 | com.xkcoding: debug 24 | -------------------------------------------------------------------------------- /spring-boot-demo-cache-redis/src/test/java/com/xkcoding/cache/redis/SpringBootDemoCacheRedisApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.cache.redis; 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 SpringBootDemoCacheRedisApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/.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 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /nbbuild/ 22 | /dist/ 23 | /nbdist/ 24 | /.nb-gradle/ 25 | /build/ 26 | 27 | ### VS Code ### 28 | .vscode/ 29 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/java/com/xkcoding/codegen/SpringBootDemoCodegenApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.codegen; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.codegen 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-03-22 09:10 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoCodegenApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoCodegenApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/java/com/xkcoding/codegen/common/IResultCode.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.codegen.common; 2 | 3 | /** 4 | *

5 | * 统一状态码接口 6 | *

7 | * 8 | * @package: com.xkcoding.rbac.shiro.common 9 | * @description: 统一状态码接口 10 | * @author: yangkai.shen 11 | * @date: Created in 2019-03-21 16:28 12 | * @copyright: Copyright (c) 2019 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface IResultCode { 17 | /** 18 | * 获取状态码 19 | * 20 | * @return 状态码 21 | */ 22 | Integer getCode(); 23 | 24 | /** 25 | * 获取返回消息 26 | * 27 | * @return 返回消息 28 | */ 29 | String getMessage(); 30 | } 31 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/java/com/xkcoding/codegen/constants/GenConstants.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.codegen.constants; 2 | 3 | /** 4 | *

5 | * 常量池 6 | *

7 | * 8 | * @package: com.xkcoding.codegen.constants 9 | * @description: 常量池 10 | * @author: yangkai.shen 11 | * @date: Created in 2019-03-22 10:04 12 | * @copyright: Copyright (c) 2019 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface GenConstants { 17 | /** 18 | * 签名 19 | */ 20 | String SIGNATURE = "xkcoding代码生成"; 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/resources/generator.properties: -------------------------------------------------------------------------------- 1 | #\u4EE3\u7801\u751F\u6210\u5668\uFF0C\u914D\u7F6E\u4FE1\u606F 2 | mainPath=com.xkcoding 3 | #\u5305\u540D 4 | package=com.xkcoding 5 | moduleName=generator 6 | #\u4F5C\u8005 7 | author=Yangkai.Shen 8 | #\u8868\u524D\u7F00(\u7C7B\u540D\u4E0D\u4F1A\u5305\u542B\u8868\u524D\u7F00) 9 | tablePrefix=tb_ 10 | #\u7C7B\u578B\u8F6C\u6362\uFF0C\u914D\u7F6E\u4FE1\u606F 11 | tinyint=Integer 12 | smallint=Integer 13 | mediumint=Integer 14 | int=Integer 15 | integer=Integer 16 | bigint=Long 17 | float=Float 18 | double=Double 19 | decimal=BigDecimal 20 | bit=Boolean 21 | char=String 22 | varchar=String 23 | tinytext=String 24 | text=String 25 | mediumtext=String 26 | longtext=String 27 | date=LocalDateTime 28 | datetime=LocalDateTime 29 | timestamp=LocalDateTime 30 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/resources/jdbc_type.properties: -------------------------------------------------------------------------------- 1 | tinyint=TINYINT 2 | smallint=SMALLINT 3 | mediumint=MEDIUMINT 4 | int=INTEGER 5 | integer=INTEGER 6 | bigint=BIGINT 7 | float=FLOAT 8 | double=DOUBLE 9 | decimal=DECIMAL 10 | bit=BIT 11 | char=CHAR 12 | varchar=VARCHAR 13 | tinytext=VARCHAR 14 | text=VARCHAR 15 | mediumtext=VARCHAR 16 | longtext=VARCHAR 17 | date=DATE 18 | datetime=DATETIME 19 | timestamp=TIMESTAMP 20 | blob=BLOB 21 | longblob=LONGBLOB 22 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/resources/static/libs/iview/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-codegen/src/main/resources/static/libs/iview/fonts/ionicons.ttf -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/resources/static/libs/iview/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-codegen/src/main/resources/static/libs/iview/fonts/ionicons.woff -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/resources/template/Mapper.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.${moduleName}.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import org.springframework.stereotype.Component; 5 | import ${package}.${moduleName}.entity.${className}; 6 | 7 | /** 8 | *

9 | * ${comments} 10 | *

11 | * 12 | * @package: ${package}.${moduleName}.mapper 13 | * @description: ${comments} 14 | * @author: ${author} 15 | * @date: Created in ${datetime} 16 | * @copyright: Copyright (c) ${year} 17 | * @version: V1.0 18 | * @modified: ${author} 19 | */ 20 | @Component 21 | public interface ${className}Mapper extends BaseMapper<${className}> { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/resources/template/Mapper.xml.vm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | #foreach($column in $columns) 6 | #if($column.lowerAttrName==$pk.lowerAttrName) 7 | 8 | #else 9 | 10 | #end 11 | #end 12 | 13 | 14 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/main/resources/template/Service.java.vm: -------------------------------------------------------------------------------- 1 | package ${package}.${moduleName}.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import ${package}.${moduleName}.entity.${className}; 5 | 6 | /** 7 | *

8 | * ${comments} 9 | *

10 | * 11 | * @package: ${package}.${moduleName}.service 12 | * @description: ${comments} 13 | * @author: ${author} 14 | * @date: Created in ${datetime} 15 | * @copyright: Copyright (c) ${year} 16 | * @version: V1.0 17 | * @modified: ${author} 18 | */ 19 | public interface ${className}Service extends IService<${className}> { 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-codegen/src/test/java/com/xkcoding/codegen/SpringBootDemoCodegenApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.codegen; 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 SpringBootDemoCodegenApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-docker/.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 | .sts4-cache 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-demo-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # 基础镜像 2 | FROM openjdk:8-jdk-alpine 3 | 4 | # 作者信息 5 | MAINTAINER "Yangkai.Shen 237497819@qq.com" 6 | 7 | # 添加一个存储空间 8 | VOLUME /tmp 9 | 10 | # 暴露8080端口 11 | EXPOSE 8080 12 | 13 | # 添加变量,如果使用dockerfile-maven-plugin,则会自动替换这里的变量内容 14 | ARG JAR_FILE=target/spring-boot-demo-docker.jar 15 | 16 | # 往容器中添加jar包 17 | ADD ${JAR_FILE} app.jar 18 | 19 | # 启动镜像自动运行程序 20 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/urandom","-jar","/app.jar"] -------------------------------------------------------------------------------- /spring-boot-demo-docker/src/main/java/com/xkcoding/docker/SpringBootDemoDockerApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.docker; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.docker 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-11-29 14:59 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoDockerApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoDockerApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-docker/src/main/java/com/xkcoding/docker/controller/HelloController.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.docker.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | /** 8 | *

9 | * Hello Controller 10 | *

11 | * 12 | * @package: com.xkcoding.docker.controller 13 | * @description: Hello Controller 14 | * @author: yangkai.shen 15 | * @date: Created in 2018-11-29 14:58 16 | * @copyright: Copyright (c) 2018 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @RestController 21 | @RequestMapping 22 | public class HelloController { 23 | @GetMapping 24 | public String hello() { 25 | return "Hello,From Docker!"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /spring-boot-demo-docker/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo -------------------------------------------------------------------------------- /spring-boot-demo-docker/src/test/java/com/xkcoding/docker/SpringBootDemoDockerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.docker; 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 SpringBootDemoDockerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-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 | .sts4-cache 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-demo-dubbo/spring-boot-demo-dubbo-common/.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 | .sts4-cache 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-demo-dubbo/spring-boot-demo-dubbo-common/src/main/java/com/xkcoding/dubbo/common/service/HelloService.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dubbo.common.service; 2 | 3 | /** 4 | *

5 | * Hello服务接口 6 | *

7 | * 8 | * @package: com.xkcoding.dubbo.common.service 9 | * @description: Hello服务接口 10 | * @author: yangkai.shen 11 | * @date: Created in 2018-12-25 16:56 12 | * @copyright: Copyright (c) 2018 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface HelloService { 17 | /** 18 | * 问好 19 | * 20 | * @param name 姓名 21 | * @return 问好 22 | */ 23 | String sayHello(String name); 24 | } 25 | -------------------------------------------------------------------------------- /spring-boot-demo-dubbo/spring-boot-demo-dubbo-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 | .sts4-cache 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-demo-dubbo/spring-boot-demo-dubbo-consumer/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | 6 | spring: 7 | dubbo: 8 | application: 9 | name: spring-boot-demo-dubbo-consumer 10 | registry: zookeeper://127.0.0.1:2181 -------------------------------------------------------------------------------- /spring-boot-demo-dubbo/spring-boot-demo-dubbo-consumer/src/test/java/com/xkcoding/dubbo/consumer/SpringBootDemoDubboConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dubbo.consumer; 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 SpringBootDemoDubboConsumerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-dubbo/spring-boot-demo-dubbo-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 | .sts4-cache 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-demo-dubbo/spring-boot-demo-dubbo-provider/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9090 3 | servlet: 4 | context-path: /demo 5 | 6 | spring: 7 | dubbo: 8 | application: 9 | name: spring-boot-demo-dubbo-provider 10 | registry: zookeeper://localhost:2181 -------------------------------------------------------------------------------- /spring-boot-demo-dubbo/spring-boot-demo-dubbo-provider/src/test/java/com/xkcoding/dubbo/provider/SpringBootDemoDubboProviderApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dubbo.provider; 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 SpringBootDemoDubboProviderApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/.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 | -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/db/user.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS `test_user` 2 | ( 3 | `id` bigint(13) NOT NULL AUTO_INCREMENT COMMENT '主键', 4 | `name` varchar(255) NOT NULL COMMENT '姓名', 5 | PRIMARY KEY (`id`) 6 | ) ENGINE = InnoDB 7 | DEFAULT CHARSET = utf8 COMMENT ='用户表'; 8 | 9 | -- 默认数据库插入如下 SQL 10 | INSERT INTO `test_user`(`id`, `name`) 11 | values (1, '默认数据库用户1'); 12 | INSERT INTO `test_user`(`id`, `name`) 13 | values (2, '默认数据库用户2'); 14 | 15 | -- 测试库1插入如下SQL 16 | INSERT INTO `test_user`(`id`, `name`) 17 | values (1, '测试库1用户1'); 18 | INSERT INTO `test_user`(`id`, `name`) 19 | values (2, '测试库1用户2'); 20 | 21 | -- 测试库2插入如下SQL 22 | INSERT INTO `test_user`(`id`, `name`) 23 | values (1, '测试库2用户1'); 24 | INSERT INTO `test_user`(`id`, `name`) 25 | values (2, '测试库2用户2'); -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/src/main/java/com/xkcoding/dynamic/datasource/annotation/DefaultDatasource.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dynamic.datasource.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | *

7 | * 用户标识仅可以使用默认数据源 8 | *

9 | * 10 | * @author yangkai.shen 11 | * @date Created in 2019/9/4 17:37 12 | */ 13 | @Target({ElementType.METHOD}) 14 | @Retention(RetentionPolicy.RUNTIME) 15 | @Documented 16 | public @interface DefaultDatasource { 17 | } 18 | -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/src/main/java/com/xkcoding/dynamic/datasource/config/MyMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dynamic.datasource.config; 2 | 3 | import tk.mybatis.mapper.annotation.RegisterMapper; 4 | import tk.mybatis.mapper.common.Mapper; 5 | import tk.mybatis.mapper.common.MySqlMapper; 6 | 7 | /** 8 | *

9 | * 通用 mapper 自定义 mapper 文件 10 | *

11 | * 12 | * @author yangkai.shen 13 | * @date Created in 2019/9/4 16:23 14 | */ 15 | @RegisterMapper 16 | public interface MyMapper extends Mapper, MySqlMapper { 17 | } 18 | -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/src/main/java/com/xkcoding/dynamic/datasource/mapper/DatasourceConfigMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dynamic.datasource.mapper; 2 | 3 | import com.xkcoding.dynamic.datasource.config.MyMapper; 4 | import com.xkcoding.dynamic.datasource.model.DatasourceConfig; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * 数据源配置 Mapper 10 | *

11 | * 12 | * @author yangkai.shen 13 | * @date Created in 2019/9/4 16:20 14 | */ 15 | @Mapper 16 | public interface DatasourceConfigMapper extends MyMapper { 17 | } 18 | -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/src/main/java/com/xkcoding/dynamic/datasource/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dynamic.datasource.mapper; 2 | 3 | import com.xkcoding.dynamic.datasource.config.MyMapper; 4 | import com.xkcoding.dynamic.datasource.model.User; 5 | import org.apache.ibatis.annotations.Mapper; 6 | 7 | /** 8 | *

9 | * 用户 Mapper 10 | *

11 | * 12 | * @author yangkai.shen 13 | * @date Created in 2019/9/4 16:49 14 | */ 15 | @Mapper 16 | public interface UserMapper extends MyMapper { 17 | } 18 | -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/src/main/java/com/xkcoding/dynamic/datasource/model/User.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dynamic.datasource.model; 2 | 3 | import lombok.Data; 4 | 5 | import javax.persistence.Column; 6 | import javax.persistence.GeneratedValue; 7 | import javax.persistence.Id; 8 | import javax.persistence.Table; 9 | import java.io.Serializable; 10 | 11 | /** 12 | *

13 | * 用户 14 | *

15 | * 16 | * @author yangkai.shen 17 | * @date Created in 2019/9/4 16:41 18 | */ 19 | @Data 20 | @Table(name = "test_user") 21 | public class User implements Serializable { 22 | /** 23 | * 主键 24 | */ 25 | @Id 26 | @Column(name = "`id`") 27 | @GeneratedValue(generator = "JDBC") 28 | private Long id; 29 | 30 | /** 31 | * 姓名 32 | */ 33 | @Column(name = "`name`") 34 | private String name; 35 | } 36 | -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | datasource: 7 | url: jdbc:mysql://127.0.0.1:3306/spring-boot-demo?useUnicode=true&characterEncoding=utf-8&useSSL=false 8 | username: root 9 | password: root 10 | driver-class-name: com.mysql.cj.jdbc.Driver 11 | -------------------------------------------------------------------------------- /spring-boot-demo-dynamic-datasource/src/test/java/com/xkcoding/dynamic/datasource/SpringBootDemoDynamicDatasourceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.dynamic.datasource; 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 SpringBootDemoDynamicDatasourceApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-elasticsearch-rest-high-level-client/.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 | .sts4-cache 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-demo-elasticsearch-rest-high-level-client/src/main/java/com/xkcoding/elasticsearch/ElasticsearchApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.elasticsearch; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * ElasticsearchApplication 8 | * 9 | * @author fxbin 10 | * @version v1.0 11 | * @since 2019/9/15 23:10 12 | */ 13 | @SpringBootApplication 14 | public class ElasticsearchApplication { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(ElasticsearchApplication.class, args); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-demo-elasticsearch-rest-high-level-client/src/main/java/com/xkcoding/elasticsearch/common/ResultCode.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.elasticsearch.common; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ResultCode 8 | * 9 | * @author fxbin 10 | * @version v1.0 11 | * @since 2019/8/26 1:47 12 | */ 13 | @Getter 14 | @AllArgsConstructor 15 | public enum ResultCode { 16 | 17 | /** 18 | * 接口调用成功 19 | */ 20 | SUCCESS(0, "Request Successful"), 21 | 22 | /** 23 | * 服务器暂不可用,建议稍候重试。建议重试次数不超过3次。 24 | */ 25 | FAILURE(-1, "System Busy"); 26 | 27 | final int code; 28 | 29 | final String msg; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /spring-boot-demo-elasticsearch-rest-high-level-client/src/main/java/com/xkcoding/elasticsearch/contants/ElasticsearchConstant.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.elasticsearch.contants; 2 | 3 | /** 4 | * ElasticsearchConstant 5 | * 6 | * @author fxbin 7 | * @version v1.0 8 | * @since 2019/9/15 23:03 9 | */ 10 | public interface ElasticsearchConstant { 11 | 12 | /** 13 | * 索引名称 14 | */ 15 | String INDEX_NAME = "person"; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /spring-boot-demo-elasticsearch-rest-high-level-client/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | demo: 2 | data: 3 | elasticsearch: 4 | cluster-name: elasticsearch 5 | cluster-nodes: 20.20.0.27:9200 6 | index: 7 | number-of-replicas: 0 8 | number-of-shards: 3 9 | -------------------------------------------------------------------------------- /spring-boot-demo-elasticsearch/.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 | .sts4-cache 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-demo-elasticsearch/src/main/java/com/xkcoding/elasticsearch/SpringBootDemoElasticsearchApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.elasticsearch; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.elasticsearch 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/27 22:52 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoElasticsearchApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoElasticsearchApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-demo-elasticsearch/src/main/java/com/xkcoding/elasticsearch/constants/EsConsts.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.elasticsearch.constants; 2 | 3 | /** 4 | *

5 | * ES常量池 6 | *

7 | * 8 | * @package: com.xkcoding.elasticsearch.constants 9 | * @description: ES常量池 10 | * @author: yangkai.shen 11 | * @date: Created in 2018-12-20 17:30 12 | * @copyright: Copyright (c) 2018 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface EsConsts { 17 | /** 18 | * 索引名称 19 | */ 20 | String INDEX_NAME = "person"; 21 | 22 | /** 23 | * 类型名称 24 | */ 25 | String TYPE_NAME = "person"; 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-demo-elasticsearch/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | data: 3 | elasticsearch: 4 | cluster-name: docker-cluster 5 | cluster-nodes: localhost:9300 -------------------------------------------------------------------------------- /spring-boot-demo-elasticsearch/src/test/java/com/xkcoding/elasticsearch/SpringBootDemoElasticsearchApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.elasticsearch; 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 SpringBootDemoElasticsearchApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-email/.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 | .sts4-cache 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-demo-email/src/main/java/com/xkcoding/email/SpringBootDemoEmailApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.email; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.email 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/11/4 22:38 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoEmailApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoEmailApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-email/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | mail: 3 | host: smtp.mxhichina.com 4 | port: 465 5 | username: spring-boot-demo@xkcoding.com 6 | # 使用 jasypt 加密密码,使用com.xkcoding.email.PasswordTest.testGeneratePassword 生成加密密码,替换 ENC(加密密码) 7 | password: ENC(OT0qGOpXrr1Iog1W+fjOiIDCJdBjHyhy) 8 | protocol: smtp 9 | test-connection: true 10 | default-encoding: UTF-8 11 | properties: 12 | mail.smtp.auth: true 13 | mail.smtp.starttls.enable: true 14 | mail.smtp.starttls.required: true 15 | mail.smtp.ssl.enable: true 16 | mail.display.sendmail: spring-boot-demo 17 | # 为 jasypt 配置解密秘钥 18 | jasypt: 19 | encryptor: 20 | password: spring-boot-demo 21 | -------------------------------------------------------------------------------- /spring-boot-demo-email/src/main/resources/static/xkcoding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-email/src/main/resources/static/xkcoding.png -------------------------------------------------------------------------------- /spring-boot-demo-email/src/test/java/com/xkcoding/email/SpringBootDemoEmailApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.email; 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 SpringBootDemoEmailApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-exception-handler/.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 | .sts4-cache 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-demo-exception-handler/src/main/java/com/xkcoding/exception/handler/SpringBootDemoExceptionHandlerApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.exception.handler; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.exception.handler 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/2 8:49 PM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoExceptionHandlerApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoExceptionHandlerApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-exception-handler/src/main/java/com/xkcoding/exception/handler/exception/JsonException.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.exception.handler.exception; 2 | 3 | import com.xkcoding.exception.handler.constant.Status; 4 | import lombok.Getter; 5 | 6 | /** 7 | *

8 | * JSON异常 9 | *

10 | * 11 | * @package: com.xkcoding.exception.handler.exception 12 | * @description: JSON异常 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/2 9:18 PM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @Getter 20 | public class JsonException extends BaseException { 21 | 22 | public JsonException(Status status) { 23 | super(status); 24 | } 25 | 26 | public JsonException(Integer code, String message) { 27 | super(code, message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-boot-demo-exception-handler/src/main/java/com/xkcoding/exception/handler/exception/PageException.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.exception.handler.exception; 2 | 3 | import com.xkcoding.exception.handler.constant.Status; 4 | import lombok.Getter; 5 | 6 | /** 7 | *

8 | * 页面异常 9 | *

10 | * 11 | * @package: com.xkcoding.exception.handler.exception 12 | * @description: 页面异常 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/2 9:18 PM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @Getter 20 | public class PageException extends BaseException { 21 | 22 | public PageException(Status status) { 23 | super(status); 24 | } 25 | 26 | public PageException(Integer code, String message) { 27 | super(code, message); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /spring-boot-demo-exception-handler/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | thymeleaf: 7 | cache: false 8 | mode: HTML 9 | encoding: UTF-8 10 | servlet: 11 | content-type: text/html -------------------------------------------------------------------------------- /spring-boot-demo-exception-handler/src/main/resources/templates/error.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 统一页面异常处理 6 | 7 | 8 |

统一页面异常处理

9 |
10 | 11 | -------------------------------------------------------------------------------- /spring-boot-demo-exception-handler/src/test/java/com/xkcoding/exception/handler/SpringBootDemoExceptionHandlerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.exception.handler; 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 SpringBootDemoExceptionHandlerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-flyway/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | -------------------------------------------------------------------------------- /spring-boot-demo-flyway/src/main/java/com/xkcoding/flyway/SpringBootDemoFlywayApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.flyway; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @author yangkai.shen 12 | * @date Created in 2020/3/4 18:30 13 | */ 14 | @SpringBootApplication 15 | public class SpringBootDemoFlywayApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(SpringBootDemoFlywayApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-flyway/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | flyway: 3 | enabled: true 4 | # 迁移前校验 SQL 文件是否存在问题 5 | validate-on-migrate: true 6 | # 生产环境一定要关闭 7 | clean-disabled: true 8 | # 校验路径下是否存在 SQL 文件 9 | check-location: false 10 | # 最开始已经存在表结构,且不存在 flyway_schema_history 表时,需要设置为 true 11 | baseline-on-migrate: true 12 | # 基础版本 0 13 | baseline-version: 0 14 | datasource: 15 | url: jdbc:mysql://127.0.0.1:3306/flyway-test?useSSL=false 16 | username: root 17 | password: root 18 | type: com.zaxxer.hikari.HikariDataSource 19 | -------------------------------------------------------------------------------- /spring-boot-demo-flyway/src/main/resources/db/migration/V1_1__ALTER.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE t_user COMMENT = '用户 v1.1'; -------------------------------------------------------------------------------- /spring-boot-demo-flyway/src/test/java/com/xkcoding/AppTest.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding; 2 | 3 | import static org.junit.Assert.assertTrue; 4 | 5 | import org.junit.Test; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | { 12 | /** 13 | * Rigorous Test :-) 14 | */ 15 | @Test 16 | public void shouldAnswerWithTrue() 17 | { 18 | assertTrue( true ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-demo-graylog/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | -------------------------------------------------------------------------------- /spring-boot-demo-graylog/src/main/java/com/xkcoding/graylog/SpringBootDemoGraylogApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.graylog; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.graylog 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-04-23 09:43 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoGraylogApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoGraylogApplication.class, args); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-demo-graylog/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: graylog -------------------------------------------------------------------------------- /spring-boot-demo-graylog/src/test/java/com/xkcoding/graylog/SpringBootDemoGraylogApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.graylog; 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 SpringBootDemoGraylogApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-helloworld/.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 | .sts4-cache 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-demo-helloworld/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo -------------------------------------------------------------------------------- /spring-boot-demo-helloworld/src/test/java/com/xkcoding/helloworld/SpringBootDemoHelloworldApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.helloworld; 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 SpringBootDemoHelloworldApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-https/.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 | -------------------------------------------------------------------------------- /spring-boot-demo-https/src/main/java/com/xkcoding/https/SpringBootDemoHttpsApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.https; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @author Chen.Chao 12 | * @date Created in 2020/1/12 10:31 13 | */ 14 | @SpringBootApplication 15 | public class SpringBootDemoHttpsApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(SpringBootDemoHttpsApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-https/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | ssl: 3 | # 证书路径 4 | key-store: classpath:server.keystore 5 | key-alias: tomcat 6 | enabled: true 7 | key-store-type: JKS 8 | #与申请时输入一致 9 | key-store-password: 123456 10 | # 浏览器默认端口 和 80 类似 11 | port: 443 12 | -------------------------------------------------------------------------------- /spring-boot-demo-https/src/main/resources/server.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-https/src/main/resources/server.keystore -------------------------------------------------------------------------------- /spring-boot-demo-https/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | spring boot demo https 6 | 7 | 8 |

9 | spring boot demo https 10 |

11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /spring-boot-demo-https/src/test/java/com/xkcoding/https/SpringBootDemoHttpsApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.https; 2 | 3 | import org.junit.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SpringBootDemoHttpsApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-demo-https/ssl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-https/ssl.png -------------------------------------------------------------------------------- /spring-boot-demo-ldap/.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 | .sts4-cache 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-demo-ldap/src/main/java/com/xkcoding/ldap/LdapDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ldap; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | * LdapDemoApplication Ldap demo 启动类 8 | * 9 | * @author fxbin 10 | * @version v1.0 11 | * @since 2019/8/26 0:37 12 | */ 13 | @SpringBootApplication 14 | public class LdapDemoApplication { 15 | 16 | public static void main(String[] args) { 17 | SpringApplication.run(LdapDemoApplication.class, args); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-boot-demo-ldap/src/main/java/com/xkcoding/ldap/api/ResultCode.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ldap.api; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | 6 | /** 7 | * ResultCode 8 | * 9 | * @author fxbin 10 | * @version v1.0 11 | * @since 2019/8/26 1:47 12 | */ 13 | @Getter 14 | @AllArgsConstructor 15 | public enum ResultCode { 16 | 17 | /** 18 | * 接口调用成功 19 | */ 20 | SUCCESS(0, "Request Successful"), 21 | 22 | /** 23 | * 服务器暂不可用,建议稍候重试。建议重试次数不超过3次。 24 | */ 25 | FAILURE(-1, "System Busy"); 26 | 27 | final int code; 28 | 29 | final String msg; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /spring-boot-demo-ldap/src/main/java/com/xkcoding/ldap/repository/PersonRepository.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ldap.repository; 2 | 3 | import com.xkcoding.ldap.entity.Person; 4 | import org.springframework.data.repository.CrudRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | import javax.naming.Name; 8 | 9 | /** 10 | * PersonRepository 11 | * 12 | * @author fxbin 13 | * @version v1.0 14 | * @since 2019/8/26 1:02 15 | */ 16 | @Repository 17 | public interface PersonRepository extends CrudRepository { 18 | 19 | /** 20 | * 根据用户名查找 21 | * 22 | * @param uid 用户名 23 | * @return com.xkcoding.ldap.entity.Person 24 | */ 25 | Person findByUid(String uid); 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-demo-ldap/src/main/java/com/xkcoding/ldap/request/LoginRequest.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ldap.request; 2 | 3 | import lombok.Builder; 4 | import lombok.Data; 5 | 6 | /** 7 | * LoginRequest 8 | * 9 | * @author fxbin 10 | * @version v1.0 11 | * @since 2019/8/26 1:50 12 | */ 13 | @Data 14 | @Builder 15 | public class LoginRequest { 16 | 17 | private String username; 18 | 19 | private String password; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-ldap/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | ldap: 3 | urls: ldap://localhost:389 4 | base: dc=example,dc=org 5 | username: cn=admin,dc=example,dc=org 6 | password: admin 7 | -------------------------------------------------------------------------------- /spring-boot-demo-log-aop/.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 | .sts4-cache 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-demo-log-aop/src/main/java/com/xkcoding/log/aop/SpringBootDemoLogAopApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.log.aop; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.log.aop 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/1 10:05 PM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoLogAopApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoLogAopApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-log-aop/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | -------------------------------------------------------------------------------- /spring-boot-demo-log-aop/src/test/java/com/xkcoding/log/aop/SpringBootDemoLogAopApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.log.aop; 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 SpringBootDemoLogAopApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-logback/.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 | .sts4-cache 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-demo-logback/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | -------------------------------------------------------------------------------- /spring-boot-demo-logback/src/test/java/com/xkcoding/logback/SpringBootDemoLogbackApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.logback; 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 SpringBootDemoLogbackApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-mongodb/.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 | .sts4-cache 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-demo-mongodb/src/main/java/com/xkcoding/mongodb/repository/ArticleRepository.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.mongodb.repository; 2 | 3 | import com.xkcoding.mongodb.model.Article; 4 | import org.springframework.data.mongodb.repository.MongoRepository; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * 文章 Dao 11 | *

12 | * 13 | * @package: com.xkcoding.mongodb.repository 14 | * @description: 文章 Dao 15 | * @author: yangkai.shen 16 | * @date: Created in 2018-12-28 16:30 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | public interface ArticleRepository extends MongoRepository { 22 | /** 23 | * 根据标题模糊查询 24 | * 25 | * @param title 标题 26 | * @return 满足条件的文章列表 27 | */ 28 | List
findByTitleLike(String title); 29 | } 30 | -------------------------------------------------------------------------------- /spring-boot-demo-mongodb/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | data: 3 | mongodb: 4 | host: localhost 5 | port: 27017 6 | database: article_db 7 | logging: 8 | level: 9 | org.springframework.data.mongodb.core: debug -------------------------------------------------------------------------------- /spring-boot-demo-mongodb/src/test/java/com/xkcoding/mongodb/SpringBootDemoMongodbApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.mongodb; 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 SpringBootDemoMongodbApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-mq-kafka/.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 | .sts4-cache 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-demo-mq-kafka/src/main/java/com/xkcoding/mq/kafka/SpringBootDemoMqKafkaApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.mq.kafka; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.mq.kafka 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-01-07 14:43 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoMqKafkaApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoMqKafkaApplication.class, args); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /spring-boot-demo-mq-kafka/src/main/java/com/xkcoding/mq/kafka/constants/KafkaConsts.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.mq.kafka.constants; 2 | 3 | /** 4 | *

5 | * kafka 常量池 6 | *

7 | * 8 | * @package: com.xkcoding.mq.kafka.constants 9 | * @description: kafka 常量池 10 | * @author: yangkai.shen 11 | * @date: Created in 2019-01-07 14:52 12 | * @copyright: Copyright (c) 2019 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface KafkaConsts { 17 | /** 18 | * 默认分区大小 19 | */ 20 | Integer DEFAULT_PARTITION_NUM = 3; 21 | 22 | /** 23 | * Topic 名称 24 | */ 25 | String TOPIC_TEST = "test"; 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-demo-mq-rabbitmq/.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 | .sts4-cache 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-demo-mq-rabbitmq/src/main/java/com/xkcoding/mq/rabbitmq/SpringBootDemoMqRabbitmqApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.mq.rabbitmq; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.mq.rabbitmq 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-29 13:58 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoMqRabbitmqApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoMqRabbitmqApplication.class, args); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /spring-boot-demo-mq-rabbitmq/src/main/java/com/xkcoding/mq/rabbitmq/message/MessageStruct.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.mq.rabbitmq.message; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Builder; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | *

12 | * 测试消息体 13 | *

14 | * 15 | * @package: com.xkcoding.mq.rabbitmq.message 16 | * @description: 测试消息体 17 | * @author: yangkai.shen 18 | * @date: Created in 2018-12-29 16:22 19 | * @copyright: Copyright (c) 2018 20 | * @version: V1.0 21 | * @modified: yangkai.shen 22 | */ 23 | @Data 24 | @Builder 25 | @NoArgsConstructor 26 | @AllArgsConstructor 27 | public class MessageStruct implements Serializable { 28 | private static final long serialVersionUID = 392365881428311040L; 29 | 30 | private String message; 31 | } 32 | -------------------------------------------------------------------------------- /spring-boot-demo-mq-rabbitmq/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | rabbitmq: 7 | host: localhost 8 | port: 5672 9 | username: guest 10 | password: guest 11 | virtual-host: / 12 | # 手动提交消息 13 | listener: 14 | simple: 15 | acknowledge-mode: manual 16 | direct: 17 | acknowledge-mode: manual -------------------------------------------------------------------------------- /spring-boot-demo-mq-rocketmq/.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 | .sts4-cache 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-demo-mq-rocketmq/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-mq-rocketmq/README.md -------------------------------------------------------------------------------- /spring-boot-demo-mq-rocketmq/src/main/java/com/xkcoding/mq/rocketmq/SpringBootDemoMqRocketmqApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.mq.rocketmq; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootDemoMqRocketmqApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootDemoMqRocketmqApplication.class, args); 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /spring-boot-demo-mq-rocketmq/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-mq-rocketmq/src/main/resources/application.properties -------------------------------------------------------------------------------- /spring-boot-demo-mq-rocketmq/src/test/java/com/xkcoding/mq/rocketmq/SpringBootDemoMqRocketmqApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.mq.rocketmq; 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 SpringBootDemoMqRocketmqApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-multi-datasource-jpa/.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 | .sts4-cache 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-demo-multi-datasource-jpa/src/main/java/com/xkcoding/multi/datasource/jpa/repository/second/SecondMultiTableRepository.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.multi.datasource.jpa.repository.second; 2 | 3 | import com.xkcoding.multi.datasource.jpa.entity.second.SecondMultiTable; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | *

9 | * 多数据源测试 repo 10 | *

11 | * 12 | * @package: com.xkcoding.multi.datasource.jpa.repository.second 13 | * @description: 多数据源测试 repo 14 | * @author: yangkai.shen 15 | * @date: Created in 2019-01-18 10:11 16 | * @copyright: Copyright (c) 2019 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @Repository 21 | public interface SecondMultiTableRepository extends JpaRepository { 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-multi-datasource-mybatis/.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 | .sts4-cache 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-demo-multi-datasource-mybatis/sql/db.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `multi_user`; 2 | CREATE TABLE `multi_user`( 3 | `id` bigint(64) NOT NULL, 4 | `name` varchar(50) DEFAULT NULL, 5 | `age` int(30) DEFAULT NULL, 6 | PRIMARY KEY (`id`) USING BTREE 7 | ) ENGINE = InnoDB 8 | AUTO_INCREMENT = 1 9 | CHARACTER SET = utf8 10 | COLLATE = utf8_general_ci; 11 | -------------------------------------------------------------------------------- /spring-boot-demo-multi-datasource-mybatis/src/main/java/com/xkcoding/multi/datasource/mybatis/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.multi.datasource.mybatis.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.xkcoding.multi.datasource.mybatis.model.User; 5 | 6 | /** 7 | *

8 | * 数据访问层 9 | *

10 | * 11 | * @package: com.xkcoding.multi.datasource.mybatis.mapper 12 | * @description: 数据访问层 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-01-21 14:28 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | public interface UserMapper extends BaseMapper { 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-demo-multi-datasource-mybatis/src/main/java/com/xkcoding/multi/datasource/mybatis/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.multi.datasource.mybatis.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.xkcoding.multi.datasource.mybatis.model.User; 5 | 6 | /** 7 | *

8 | * 数据服务层 9 | *

10 | * 11 | * @package: com.xkcoding.multi.datasource.mybatis.service 12 | * @description: 数据服务层 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-01-21 14:31 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | public interface UserService extends IService { 20 | 21 | /** 22 | * 添加 User 23 | * 24 | * @param user 用户 25 | */ 26 | void addUser(User user); 27 | } 28 | -------------------------------------------------------------------------------- /spring-boot-demo-multi-datasource-mybatis/src/test/java/com/xkcoding/multi/datasource/mybatis/SpringBootDemoMultiDatasourceMybatisApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.multi.datasource.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 SpringBootDemoMultiDatasourceMybatisApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-neo4j/.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 | .sts4-cache 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-demo-neo4j/src/main/java/com/xkcoding/neo4j/SpringBootDemoNeo4jApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.neo4j; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.neo4j 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-22 23:50 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoNeo4jApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoNeo4jApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-neo4j/src/main/java/com/xkcoding/neo4j/config/CustomIdStrategy.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.neo4j.config; 2 | 3 | import cn.hutool.core.util.IdUtil; 4 | import org.neo4j.ogm.id.IdStrategy; 5 | 6 | /** 7 | *

8 | * 自定义主键策略 9 | *

10 | * 11 | * @package: com.xkcoding.neo4j.config 12 | * @description: 自定义主键策略 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-24 14:40 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | public class CustomIdStrategy implements IdStrategy { 20 | @Override 21 | public Object generateId(Object o) { 22 | return IdUtil.fastUUID(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spring-boot-demo-neo4j/src/main/java/com/xkcoding/neo4j/payload/TeacherStudent.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.neo4j.payload; 2 | 3 | import com.xkcoding.neo4j.model.Student; 4 | import lombok.Data; 5 | import org.springframework.data.neo4j.annotation.QueryResult; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | *

11 | * 师生关系 12 | *

13 | * 14 | * @package: com.xkcoding.neo4j.payload 15 | * @description: 师生关系 16 | * @author: yangkai.shen 17 | * @date: Created in 2018-12-24 19:18 18 | * @copyright: Copyright (c) 2018 19 | * @version: V1.0 20 | * @modified: yangkai.shen 21 | */ 22 | @Data 23 | @QueryResult 24 | public class TeacherStudent { 25 | /** 26 | * 教师姓名 27 | */ 28 | private String teacherName; 29 | 30 | /** 31 | * 学生信息 32 | */ 33 | private List students; 34 | } 35 | -------------------------------------------------------------------------------- /spring-boot-demo-neo4j/src/main/java/com/xkcoding/neo4j/repository/ClassRepository.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.neo4j.repository; 2 | 3 | import com.xkcoding.neo4j.model.Class; 4 | import org.springframework.data.neo4j.repository.Neo4jRepository; 5 | 6 | import java.util.Optional; 7 | 8 | /** 9 | *

10 | * 班级节点Repository 11 | *

12 | * 13 | * @package: com.xkcoding.neo4j.repository 14 | * @description: 班级节点Repository 15 | * @author: yangkai.shen 16 | * @date: Created in 2018-12-24 15:05 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | public interface ClassRepository extends Neo4jRepository { 22 | /** 23 | * 根据班级名称查询班级信息 24 | * 25 | * @param name 班级名称 26 | * @return 班级信息 27 | */ 28 | Optional findByName(String name); 29 | } 30 | -------------------------------------------------------------------------------- /spring-boot-demo-neo4j/src/main/java/com/xkcoding/neo4j/repository/LessonRepository.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.neo4j.repository; 2 | 3 | import com.xkcoding.neo4j.model.Lesson; 4 | import org.springframework.data.neo4j.repository.Neo4jRepository; 5 | 6 | /** 7 | *

8 | * 课程节点Repository 9 | *

10 | * 11 | * @package: com.xkcoding.neo4j.repository 12 | * @description: 课程节点Repository 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-24 15:05 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | public interface LessonRepository extends Neo4jRepository { 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-demo-neo4j/src/main/java/com/xkcoding/neo4j/repository/TeacherRepository.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.neo4j.repository; 2 | 3 | import com.xkcoding.neo4j.model.Teacher; 4 | import org.springframework.data.neo4j.repository.Neo4jRepository; 5 | 6 | /** 7 | *

8 | * 教师节点Repository 9 | *

10 | * 11 | * @package: com.xkcoding.neo4j.repository 12 | * @description: 教师节点Repository 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-24 15:05 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | public interface TeacherRepository extends Neo4jRepository { 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-demo-neo4j/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | data: 3 | neo4j: 4 | uri: bolt://localhost 5 | username: neo4j 6 | password: admin 7 | open-in-view: false -------------------------------------------------------------------------------- /spring-boot-demo-neo4j/src/test/java/com/xkcoding/neo4j/SpringBootDemoNeo4jApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.neo4j; 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 SpringBootDemoNeo4jApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/.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 | .sts4-cache 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-demo-oauth/README.md: -------------------------------------------------------------------------------- 1 | # spring-boot-demo-oauth 2 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/image/Code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/image/Code.png -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/image/Confirm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/image/Confirm.png -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/image/Login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/image/Login.png -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/image/Logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/image/Logout.png -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/main/java/com/xkcoding/oauth/controller/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 控制器。除了业务逻辑的以外,提供两个控制器来帮助完成自定义: 3 | * {@link com.xkcoding.oauth.controller.AuthorizationController} 4 | * 自定义的授权控制器,重新设置到我们的界面中去,不使用他的默认实现 5 | * 6 | * {@link com.xkcoding.oauth.controller.Oauth2Controller} 7 | * 页面跳转的控制器,这里拿出来是因为真的可以做很多事。比如登录的时候携带点什么 8 | * 或者退出的时候携带什么标识,都可以。 9 | * 10 | * @author EchoCow 11 | * @date 2020/1/7 上午11:25 12 | * @see org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint 13 | */ 14 | package com.xkcoding.oauth.controller; 15 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/main/java/com/xkcoding/oauth/repostiory/SysUserRepository.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.oauth.repostiory; 2 | 3 | import com.xkcoding.oauth.entity.SysUser; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.Optional; 7 | 8 | /** 9 | * 用户信息仓库. 10 | * 11 | * @author EchoCow 12 | * @date 2020/1/6 下午1:08 13 | */ 14 | public interface SysUserRepository extends JpaRepository { 15 | 16 | /** 17 | * 通过用户名查找用户. 18 | * 19 | * @param username 用户名 20 | * @return 结果 21 | */ 22 | Optional findFirstByUsername(String username); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/main/java/com/xkcoding/oauth/service/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * service 层,继承并实现 spring 接口. 3 | * 4 | * @author EchoCow 5 | * @date 2020/1/7 上午9:16 6 | */ 7 | package com.xkcoding.oauth.service; 8 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | 4 | spring: 5 | datasource: 6 | url: jdbc:mysql://localhost:3306/oauth?allowPublicKeyRetrieval=true 7 | username: root 8 | password: 123456 9 | hikari: 10 | data-source-properties: 11 | useSSL: false 12 | serverTimezone: GMT+8 13 | useUnicode: true 14 | characterEncoding: utf8 15 | jpa: 16 | hibernate: 17 | ddl-auto: update 18 | show-sql: true 19 | 20 | logging: 21 | level: 22 | org.springframework.security: debug 23 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/main/resources/oauth2.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/main/resources/oauth2.jks -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/main/resources/public.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkF9SyMHeGAsLMwbPsKj/ 3 | xpEtS0iCe8vTSBnIGBDZKmB3ma20Ry0Uzn3m+f40RwCXlxnUcvTw7ipoz0tMQERQ 4 | b3X4DkYCJXPK6pAD+R9/J5odEwrO2eysByWfcbMjsZw2u5pH5hleMS0YqkrGQOxJ 5 | pzlEcKxMePU5KYTbKUJkhOYPY+gQr61g6lF97WggSPtuQn1srT+Ptvfw6yRC4bdI 6 | 0zV5emfXjmoLUwaQTRoGYhOFrm97vpoKiltSNIDFW01J1Lr+l77ddDFC6cdiAC0H 7 | 5/eENWBBBTFWya8RlBTzHuikfFS1gP49PZ6MYJIVRs8p9YnnKTy7TVcGKY3XZMCA 8 | mwIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/test/java/com/xkcoding/oauth/PasswordEncodeTest.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.oauth; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 5 | import org.springframework.security.crypto.password.PasswordEncoder; 6 | 7 | /** 8 | * . 9 | * 10 | * @author EchoCow 11 | * @date 2020/1/6 下午3:51 12 | */ 13 | public class PasswordEncodeTest { 14 | 15 | private PasswordEncoder passwordEncoder = new BCryptPasswordEncoder(); 16 | 17 | @Test 18 | public void getPasswordWhenPassed() { 19 | System.out.println(passwordEncoder.encode("oauth2")); 20 | System.out.println(passwordEncoder.encode("123456")); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-authorization-server/src/test/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | 6 | spring: 7 | datasource: 8 | url: jdbc:h2:mem:oauth2?options=DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE 9 | username: root 10 | password: 123456 11 | jpa: 12 | hibernate: 13 | ddl-auto: create-drop 14 | show-sql: true 15 | properties: 16 | hibernate: 17 | format_sql: true 18 | 19 | logging: 20 | level: 21 | org.springframework.security: debug 22 | -------------------------------------------------------------------------------- /spring-boot-demo-oauth/spring-boot-demo-oauth-resource-server/src/main/java/com/xkcoding/oauth/SpringBootDemoResourceApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.oauth; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; 6 | 7 | /** 8 | * 启动器. 9 | * 10 | * @author EchoCow 11 | * @date 2020/1/9 上午11:38 12 | * @version V1.0 13 | */ 14 | @EnableResourceServer 15 | @SpringBootApplication 16 | public class SpringBootDemoResourceApplication { 17 | public static void main(String[] args) { 18 | SpringApplication.run(SpringBootDemoResourceApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-beetlsql/.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 | .sts4-cache 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-demo-orm-beetlsql/src/main/java/com/xkcoding/orm/beetlsql/SpringBootDemoOrmBeetlsqlApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.beetlsql; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.orm.beetlsql 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/11/14 15:47 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoOrmBeetlsqlApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoOrmBeetlsqlApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-beetlsql/src/main/java/com/xkcoding/orm/beetlsql/dao/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.beetlsql.dao; 2 | 3 | import com.xkcoding.orm.beetlsql.entity.User; 4 | import org.beetl.sql.core.mapper.BaseMapper; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | *

9 | * UserDao 10 | *

11 | * 12 | * @package: com.xkcoding.orm.beetlsql.dao 13 | * @description: UserDao 14 | * @author: yangkai.shen 15 | * @date: Created in 2018/11/14 16:18 16 | * @copyright: Copyright (c) 2018 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @Component 21 | public interface UserDao extends BaseMapper { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-beetlsql/src/main/resources/db/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (1, 'user_1', 'ff342e862e7c3285cdc07e56d6b8973b', '412365a109674b2dbb1981ed561a4c70', 'user1@xkcoding.com', '17300000001'); 2 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (2, 'user_2', '6c6bf02c8d5d3d128f34b1700cb1e32c', 'fcbdd0e8a9404a5585ea4e01d0e4d7a0', 'user2@xkcoding.com', '17300000002'); -------------------------------------------------------------------------------- /spring-boot-demo-orm-beetlsql/src/main/resources/db/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `orm_user`; 2 | CREATE TABLE `orm_user` ( 3 | `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '主键', 4 | `name` VARCHAR(32) NOT NULL UNIQUE COMMENT '用户名', 5 | `password` VARCHAR(32) NOT NULL COMMENT '加密后的密码', 6 | `salt` VARCHAR(32) NOT NULL COMMENT '加密使用的盐', 7 | `email` VARCHAR(32) NOT NULL UNIQUE COMMENT '邮箱', 8 | `phone_number` VARCHAR(15) NOT NULL UNIQUE COMMENT '手机号码', 9 | `status` INT(2) NOT NULL DEFAULT 1 COMMENT '状态,-1:逻辑删除,0:禁用,1:启用', 10 | `create_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '创建时间', 11 | `last_login_time` DATETIME DEFAULT NULL COMMENT '上次登录时间', 12 | `last_update_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '上次更新时间' 13 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Spring Boot Demo Orm 系列示例表'; 14 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-beetlsql/src/test/java/com/xkcoding/orm/beetlsql/SpringBootDemoOrmBeetlsqlApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.beetlsql; 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 SpringBootDemoOrmBeetlsqlApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jdbctemplate/.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 | .sts4-cache 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-demo-orm-jdbctemplate/src/main/java/com/xkcoding/orm/jdbctemplate/annotation/Column.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.jdbctemplate.annotation; 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 | *

10 | * 列注解 11 | *

12 | * 13 | * @package: com.xkcoding.orm.jdbctemplate.annotation 14 | * @description: 列注解 15 | * @author: yangkai.shen 16 | * @date: Created in 2018/10/15 11:23 AM 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @Target({ElementType.FIELD}) 23 | public @interface Column { 24 | /** 25 | * 列名 26 | * 27 | * @return 列名 28 | */ 29 | String name(); 30 | } 31 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jdbctemplate/src/main/java/com/xkcoding/orm/jdbctemplate/annotation/Ignore.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.jdbctemplate.annotation; 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 | *

10 | * 需要忽略的字段 11 | *

12 | * 13 | * @package: com.xkcoding.orm.jdbctemplate.annotation 14 | * @description: 需要忽略的字段 15 | * @author: yangkai.shen 16 | * @date: Created in 2018/10/15 1:25 PM 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @Target({ElementType.FIELD}) 23 | public @interface Ignore { 24 | } 25 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jdbctemplate/src/main/java/com/xkcoding/orm/jdbctemplate/annotation/Pk.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.jdbctemplate.annotation; 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 | *

10 | * 主键注解 11 | *

12 | * 13 | * @package: com.xkcoding.orm.jdbctemplate.annotation 14 | * @description: 主键注解 15 | * @author: yangkai.shen 16 | * @date: Created in 2018/10/15 11:23 AM 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @Target({ElementType.FIELD}) 23 | public @interface Pk { 24 | /** 25 | * 自增 26 | * 27 | * @return 自增主键 28 | */ 29 | boolean auto() default true; 30 | } 31 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jdbctemplate/src/main/java/com/xkcoding/orm/jdbctemplate/annotation/Table.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.jdbctemplate.annotation; 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 | *

10 | * 表注解 11 | *

12 | * 13 | * @package: com.xkcoding.orm.jdbctemplate.annotation 14 | * @description: 表注解 15 | * @author: yangkai.shen 16 | * @date: Created in 2018/10/15 11:23 AM 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @Target({ElementType.TYPE}) 23 | public @interface Table { 24 | /** 25 | * 表名 26 | * 27 | * @return 表名 28 | */ 29 | String name(); 30 | } 31 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jdbctemplate/src/main/java/com/xkcoding/orm/jdbctemplate/constant/Const.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.jdbctemplate.constant; 2 | 3 | /** 4 | *

5 | * 常量池 6 | *

7 | * 8 | * @package: com.xkcoding.orm.jdbctemplate.constant 9 | * @description: 常量池 10 | * @author: yangkai.shen 11 | * @date: Created in 2018/10/15 10:59 AM 12 | * @copyright: Copyright (c) 2018 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface Const { 17 | /** 18 | * 加密盐前缀 19 | */ 20 | String SALT_PREFIX = "::SpringBootDemo::"; 21 | 22 | /** 23 | * 逗号分隔符 24 | */ 25 | String SEPARATOR_COMMA = ","; 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jdbctemplate/src/main/resources/db/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (1, 'user_1', 'ff342e862e7c3285cdc07e56d6b8973b', '412365a109674b2dbb1981ed561a4c70', 'user1@xkcoding.com', '17300000001'); 2 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (2, 'user_2', '6c6bf02c8d5d3d128f34b1700cb1e32c', 'fcbdd0e8a9404a5585ea4e01d0e4d7a0', 'user2@xkcoding.com', '17300000002'); -------------------------------------------------------------------------------- /spring-boot-demo-orm-jdbctemplate/src/main/resources/db/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `orm_user`; 2 | CREATE TABLE `orm_user` ( 3 | `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '主键', 4 | `name` VARCHAR(32) NOT NULL UNIQUE COMMENT '用户名', 5 | `password` VARCHAR(32) NOT NULL COMMENT '加密后的密码', 6 | `salt` VARCHAR(32) NOT NULL COMMENT '加密使用的盐', 7 | `email` VARCHAR(32) NOT NULL UNIQUE COMMENT '邮箱', 8 | `phone_number` VARCHAR(15) NOT NULL UNIQUE COMMENT '手机号码', 9 | `status` INT(2) NOT NULL DEFAULT 1 COMMENT '状态,-1:逻辑删除,0:禁用,1:启用', 10 | `create_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '创建时间', 11 | `last_login_time` DATETIME DEFAULT NULL COMMENT '上次登录时间', 12 | `last_update_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '上次更新时间' 13 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Spring Boot Demo Orm 系列示例表'; 14 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jdbctemplate/src/test/java/com/xkcoding/orm/jdbctemplate/SpringBootDemoOrmJdbctemplateApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.jdbctemplate; 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 SpringBootDemoOrmJdbctemplateApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jpa/.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 | .sts4-cache 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-demo-orm-jpa/src/main/java/com/xkcoding/orm/jpa/SpringBootDemoOrmJpaApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.jpa; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.orm.jpa 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/28 22:58 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoOrmJpaApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoOrmJpaApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jpa/src/main/java/com/xkcoding/orm/jpa/repository/UserDao.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.jpa.repository; 2 | 3 | import com.xkcoding.orm.jpa.entity.User; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | *

9 | * User Dao 10 | *

11 | * 12 | * @package: com.xkcoding.orm.jpa.repository 13 | * @description: User Dao 14 | * @author: yangkai.shen 15 | * @date: Created in 2018/11/7 14:07 16 | * @copyright: Copyright (c) 2018 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @Repository 21 | public interface UserDao extends JpaRepository { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-jpa/src/main/resources/db/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (1, 'user_1', 'ff342e862e7c3285cdc07e56d6b8973b', '412365a109674b2dbb1981ed561a4c70', 'user1@xkcoding.com', '17300000001'); 2 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (2, 'user_2', '6c6bf02c8d5d3d128f34b1700cb1e32c', 'fcbdd0e8a9404a5585ea4e01d0e4d7a0', 'user2@xkcoding.com', '17300000002'); -------------------------------------------------------------------------------- /spring-boot-demo-orm-jpa/src/test/java/com/xkcoding/orm/jpa/SpringBootDemoOrmJpaApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.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 SpringBootDemoOrmJpaApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-mapper-page/.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 | .sts4-cache 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-demo-orm-mybatis-mapper-page/src/main/java/com/xkcoding/orm/mybatis/MapperAndPage/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.mybatis.MapperAndPage.mapper; 2 | 3 | import com.xkcoding.orm.mybatis.MapperAndPage.entity.User; 4 | import org.springframework.stereotype.Component; 5 | import tk.mybatis.mapper.common.Mapper; 6 | import tk.mybatis.mapper.common.MySqlMapper; 7 | 8 | /** 9 | *

10 | * UserMapper 11 | *

12 | * 13 | * @package: com.xkcoding.orm.mybatis.MapperAndPage.mapper 14 | * @description: UserMapper 15 | * @author: yangkai.shen 16 | * @date: Created in 2018/11/8 14:15 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | @Component 22 | public interface UserMapper extends Mapper, MySqlMapper { 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-mapper-page/src/main/resources/db/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (1, 'user_1', 'ff342e862e7c3285cdc07e56d6b8973b', '412365a109674b2dbb1981ed561a4c70', 'user1@xkcoding.com', '17300000001'); 2 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (2, 'user_2', '6c6bf02c8d5d3d128f34b1700cb1e32c', 'fcbdd0e8a9404a5585ea4e01d0e4d7a0', 'user2@xkcoding.com', '17300000002'); -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-mapper-page/src/main/resources/db/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `orm_user`; 2 | CREATE TABLE `orm_user` ( 3 | `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '主键', 4 | `name` VARCHAR(32) NOT NULL UNIQUE COMMENT '用户名', 5 | `password` VARCHAR(32) NOT NULL COMMENT '加密后的密码', 6 | `salt` VARCHAR(32) NOT NULL COMMENT '加密使用的盐', 7 | `email` VARCHAR(32) NOT NULL UNIQUE COMMENT '邮箱', 8 | `phone_number` VARCHAR(15) NOT NULL UNIQUE COMMENT '手机号码', 9 | `status` INT(2) NOT NULL DEFAULT 1 COMMENT '状态,-1:逻辑删除,0:禁用,1:启用', 10 | `create_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '创建时间', 11 | `last_login_time` DATETIME DEFAULT NULL COMMENT '上次登录时间', 12 | `last_update_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '上次更新时间' 13 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Spring Boot Demo Orm 系列示例表'; 14 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-mapper-page/src/test/java/com/xkcoding/orm/mybatis/MapperAndPage/SpringBootDemoOrmMybatisMapperPageApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.mybatis.MapperAndPage; 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 SpringBootDemoOrmMybatisMapperPageApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-plus/.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 | .sts4-cache 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-demo-orm-mybatis-plus/src/main/java/com/xkcoding/orm/mybatis/plus/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.mybatis.plus.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.xkcoding.orm.mybatis.plus.entity.Role; 5 | 6 | /** 7 | *

8 | * RoleMapper 9 | *

10 | * 11 | * @author yangkai.shen 12 | * @date Created in 2019/9/14 14:06 13 | */ 14 | public interface RoleMapper extends BaseMapper { 15 | } 16 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-plus/src/main/java/com/xkcoding/orm/mybatis/plus/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.mybatis.plus.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.xkcoding.orm.mybatis.plus.entity.User; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | *

9 | * UserMapper 10 | *

11 | * 12 | * @package: com.xkcoding.orm.mybatis.plus.mapper 13 | * @description: UserMapper 14 | * @author: yangkai.shen 15 | * @date: Created in 2018/11/8 16:57 16 | * @copyright: Copyright (c) 2018 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @Component 21 | public interface UserMapper extends BaseMapper { 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-plus/src/main/java/com/xkcoding/orm/mybatis/plus/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.mybatis.plus.service; 2 | 3 | import com.baomidou.mybatisplus.extension.service.IService; 4 | import com.xkcoding.orm.mybatis.plus.entity.User; 5 | 6 | /** 7 | *

8 | * User Service 9 | *

10 | * 11 | * @package: com.xkcoding.orm.mybatis.plus.service 12 | * @description: User Service 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/11/8 18:10 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | public interface UserService extends IService { 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-plus/src/main/resources/db/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (1, 'user_1', 'ff342e862e7c3285cdc07e56d6b8973b', '412365a109674b2dbb1981ed561a4c70', 'user1@xkcoding.com', '17300000001'); 2 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (2, 'user_2', '6c6bf02c8d5d3d128f34b1700cb1e32c', 'fcbdd0e8a9404a5585ea4e01d0e4d7a0', 'user2@xkcoding.com', '17300000002'); 3 | 4 | INSERT INTO `orm_role`(`id`,`name`) VALUES (1,'管理员'),(2,'普通用户'); 5 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis-plus/src/test/java/com/xkcoding/orm/mybatis/plus/SpringBootDemoOrmMybatisPlusApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.mybatis.plus; 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 SpringBootDemoOrmMybatisPlusApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis/.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 | .sts4-cache 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-demo-orm-mybatis/src/main/resources/db/data.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (1, 'user_1', 'ff342e862e7c3285cdc07e56d6b8973b', '412365a109674b2dbb1981ed561a4c70', 'user1@xkcoding.com', '17300000001'); 2 | INSERT INTO `orm_user`(`id`,`name`,`password`,`salt`,`email`,`phone_number`) VALUES (2, 'user_2', '6c6bf02c8d5d3d128f34b1700cb1e32c', 'fcbdd0e8a9404a5585ea4e01d0e4d7a0', 'user2@xkcoding.com', '17300000002'); -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis/src/main/resources/db/schema.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `orm_user`; 2 | CREATE TABLE `orm_user` ( 3 | `id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '主键', 4 | `name` VARCHAR(32) NOT NULL UNIQUE COMMENT '用户名', 5 | `password` VARCHAR(32) NOT NULL COMMENT '加密后的密码', 6 | `salt` VARCHAR(32) NOT NULL COMMENT '加密使用的盐', 7 | `email` VARCHAR(32) NOT NULL UNIQUE COMMENT '邮箱', 8 | `phone_number` VARCHAR(15) NOT NULL UNIQUE COMMENT '手机号码', 9 | `status` INT(2) NOT NULL DEFAULT 1 COMMENT '状态,-1:逻辑删除,0:禁用,1:启用', 10 | `create_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '创建时间', 11 | `last_login_time` DATETIME DEFAULT NULL COMMENT '上次登录时间', 12 | `last_update_time` DATETIME NOT NULL DEFAULT NOW() COMMENT '上次更新时间' 13 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Spring Boot Demo Orm 系列示例表'; 14 | -------------------------------------------------------------------------------- /spring-boot-demo-orm-mybatis/src/test/java/com/xkcoding/orm/mybatis/SpringBootDemoOrmMybatisApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.orm.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 SpringBootDemoOrmMybatisApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-properties/.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 | .sts4-cache 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-demo-properties/src/main/java/com/xkcoding/properties/SpringBootDemoPropertiesApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.properties; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.properties 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/9/29 10:48 AM 15 | * @copyright: Copyright (c)2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoPropertiesApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoPropertiesApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-properties/src/main/java/com/xkcoding/properties/property/ApplicationProperty.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.properties.property; 2 | 3 | import lombok.Data; 4 | import org.springframework.beans.factory.annotation.Value; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | *

9 | * 项目配置 10 | *

11 | * 12 | * @package: com.xkcoding.properties.property 13 | * @description: 项目配置 14 | * @author: yangkai.shen 15 | * @date: Created in 2018/9/29 10:50 AM 16 | * @copyright: Copyright (c) 2018 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @Data 21 | @Component 22 | public class ApplicationProperty { 23 | @Value("${application.name}") 24 | private String name; 25 | @Value("${application.version}") 26 | private String version; 27 | } 28 | -------------------------------------------------------------------------------- /spring-boot-demo-properties/src/main/java/com/xkcoding/properties/property/DeveloperProperty.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.properties.property; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | *

9 | * 开发人员配置信息 10 | *

11 | * 12 | * @package: com.xkcoding.properties.property 13 | * @description: 开发人员配置信息 14 | * @author: yangkai.shen 15 | * @date: Created in 2018/9/29 10:51 AM 16 | * @copyright: Copyright (c) 2018 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @Data 21 | @ConfigurationProperties(prefix = "developer") 22 | @Component 23 | public class DeveloperProperty { 24 | private String name; 25 | private String website; 26 | private String qq; 27 | private String phoneNumber; 28 | } 29 | -------------------------------------------------------------------------------- /spring-boot-demo-properties/src/main/resources/application-dev.yml: -------------------------------------------------------------------------------- 1 | application: 2 | name: dev环境 @artifactId@ 3 | version: dev环境 @version@ 4 | developer: 5 | name: dev环境 xkcoding 6 | website: dev环境 http://xkcoding.com 7 | qq: dev环境 237497819 8 | phone-number: dev环境 17326075631 -------------------------------------------------------------------------------- /spring-boot-demo-properties/src/main/resources/application-prod.yml: -------------------------------------------------------------------------------- 1 | application: 2 | name: prod环境 @artifactId@ 3 | version: prod环境 @version@ 4 | developer: 5 | name: prod环境 xkcoding 6 | website: prod环境 http://xkcoding.com 7 | qq: prod环境 237497819 8 | phone-number: prod环境 17326075631 -------------------------------------------------------------------------------- /spring-boot-demo-properties/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | profiles: 7 | active: prod -------------------------------------------------------------------------------- /spring-boot-demo-properties/src/test/java/com/xkcoding/properties/SpringBootDemoPropertiesApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.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 SpringBootDemoPropertiesApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-guava/.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 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-guava/src/main/java/com/xkcoding/ratelimit/guava/SpringBootDemoRatelimitGuavaApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ratelimit.guava; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @author yangkai.shen 12 | * @date Created in 2019/9/12 14:06 13 | */ 14 | @SpringBootApplication 15 | public class SpringBootDemoRatelimitGuavaApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(SpringBootDemoRatelimitGuavaApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-guava/src/main/java/com/xkcoding/ratelimit/guava/handler/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ratelimit.guava.handler; 2 | 3 | import cn.hutool.core.lang.Dict; 4 | import org.springframework.web.bind.annotation.ExceptionHandler; 5 | import org.springframework.web.bind.annotation.RestControllerAdvice; 6 | 7 | /** 8 | *

9 | * 全局异常拦截 10 | *

11 | * 12 | * @author yangkai.shen 13 | * @date Created in 2019/9/12 15:00 14 | */ 15 | @RestControllerAdvice 16 | public class GlobalExceptionHandler { 17 | 18 | @ExceptionHandler(RuntimeException.class) 19 | public Dict handler(RuntimeException ex) { 20 | return Dict.create().set("msg", ex.getMessage()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-guava/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | logging: 6 | level: 7 | com.xkcoding: debug 8 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-guava/src/test/java/com/xkcoding/ratelimit/guava/SpringBootDemoRatelimitGuavaApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ratelimit.guava; 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 SpringBootDemoRatelimitGuavaApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-redis/.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 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-redis/src/main/java/com/xkcoding/ratelimit/redis/SpringBootDemoRatelimitRedisApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ratelimit.redis; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @author yangkai.shen 12 | * @date Created in 2019/9/30 09:32 13 | */ 14 | @SpringBootApplication 15 | public class SpringBootDemoRatelimitRedisApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(SpringBootDemoRatelimitRedisApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-redis/src/main/java/com/xkcoding/ratelimit/redis/handler/GlobalExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ratelimit.redis.handler; 2 | 3 | import cn.hutool.core.lang.Dict; 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.springframework.web.bind.annotation.ExceptionHandler; 6 | import org.springframework.web.bind.annotation.RestControllerAdvice; 7 | 8 | /** 9 | *

10 | * 全局异常拦截 11 | *

12 | * 13 | * @author yangkai.shen 14 | * @date Created in 2019/9/30 10:30 15 | */ 16 | @Slf4j 17 | @RestControllerAdvice 18 | public class GlobalExceptionHandler { 19 | 20 | @ExceptionHandler(RuntimeException.class) 21 | public Dict handler(RuntimeException ex) { 22 | return Dict.create().set("msg", ex.getMessage()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-redis/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | redis: 7 | host: localhost 8 | # 连接超时时间(记得添加单位,Duration) 9 | timeout: 10000ms 10 | # Redis默认情况下有16个分片,这里配置具体使用的分片 11 | # database: 0 12 | lettuce: 13 | pool: 14 | # 连接池最大连接数(使用负值表示没有限制) 默认 8 15 | max-active: 8 16 | # 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1 17 | max-wait: -1ms 18 | # 连接池中的最大空闲连接 默认 8 19 | max-idle: 8 20 | # 连接池中的最小空闲连接 默认 0 21 | min-idle: 0 22 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-redis/src/main/resources/scripts/redis/limit.lua: -------------------------------------------------------------------------------- 1 | -- 下标从 1 开始 2 | local key = KEYS[1] 3 | local now = tonumber(ARGV[1]) 4 | local ttl = tonumber(ARGV[2]) 5 | local expired = tonumber(ARGV[3]) 6 | -- 最大访问量 7 | local max = tonumber(ARGV[4]) 8 | 9 | -- 清除过期的数据 10 | -- 移除指定分数区间内的所有元素,expired 即已经过期的 score 11 | -- 根据当前时间毫秒数 - 超时毫秒数,得到过期时间 expired 12 | redis.call('zremrangebyscore', key, 0, expired) 13 | 14 | -- 获取 zset 中的当前元素个数 15 | local current = tonumber(redis.call('zcard', key)) 16 | local next = current + 1 17 | 18 | if next > max then 19 | -- 达到限流大小 返回 0 20 | return 0; 21 | else 22 | -- 往 zset 中添加一个值、得分均为当前时间戳的元素,[value,score] 23 | redis.call("zadd", key, now, now) 24 | -- 每次访问均重新设置 zset 的过期时间,单位毫秒 25 | redis.call("pexpire", key, ttl) 26 | return next 27 | end 28 | -------------------------------------------------------------------------------- /spring-boot-demo-ratelimit-redis/src/test/java/com/xkcoding/ratelimit/redis/SpringBootDemoRatelimiterRedisApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ratelimit.redis; 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 SpringBootDemoRatelimiterRedisApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-rbac-security/.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 | .sts4-cache 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-demo-rbac-security/src/main/java/com/xkcoding/rbac/security/SpringBootDemoRbacSecurityApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.security; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.rbac.security 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-10 11:28 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoRbacSecurityApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoRbacSecurityApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-rbac-security/src/main/java/com/xkcoding/rbac/security/common/IStatus.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.security.common; 2 | 3 | /** 4 | *

5 | * REST API 错误码接口 6 | *

7 | * 8 | * @package: com.xkcoding.rbac.security.common 9 | * @description: REST API 错误码接口 10 | * @author: yangkai.shen 11 | * @date: Created in 2018-12-07 14:35 12 | * @copyright: Copyright (c) 2018 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface IStatus { 17 | 18 | /** 19 | * 状态码 20 | * 21 | * @return 状态码 22 | */ 23 | Integer getCode(); 24 | 25 | /** 26 | * 返回信息 27 | * 28 | * @return 返回信息 29 | */ 30 | String getMessage(); 31 | 32 | } -------------------------------------------------------------------------------- /spring-boot-demo-rbac-security/src/main/java/com/xkcoding/rbac/security/config/CustomConfig.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.security.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | /** 7 | *

8 | * 自定义配置 9 | *

10 | * 11 | * @package: com.xkcoding.rbac.security.config 12 | * @description: 自定义配置 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-13 10:56 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @ConfigurationProperties(prefix = "custom.config") 20 | @Data 21 | public class CustomConfig { 22 | /** 23 | * 不需要拦截的地址 24 | */ 25 | private IgnoreConfig ignores; 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-demo-rbac-security/src/main/java/com/xkcoding/rbac/security/model/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.security.model; 2 | 3 | import com.xkcoding.rbac.security.model.unionkey.UserRoleKey; 4 | import lombok.Data; 5 | 6 | import javax.persistence.EmbeddedId; 7 | import javax.persistence.Entity; 8 | import javax.persistence.Table; 9 | 10 | /** 11 | *

12 | * 用户角色关联 13 | *

14 | * 15 | * @package: com.xkcoding.rbac.security.model 16 | * @description: 用户角色关联 17 | * @author: yangkai.shen 18 | * @date: Created in 2018-12-10 11:18 19 | * @copyright: Copyright (c) 2018 20 | * @version: V1.0 21 | * @modified: yangkai.shen 22 | */ 23 | @Data 24 | @Entity 25 | @Table(name = "sec_user_role") 26 | public class UserRole { 27 | /** 28 | * 主键 29 | */ 30 | @EmbeddedId 31 | private UserRoleKey id; 32 | } 33 | -------------------------------------------------------------------------------- /spring-boot-demo-rbac-security/src/main/java/com/xkcoding/rbac/security/payload/PageCondition.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.security.payload; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 分页请求参数 8 | *

9 | * 10 | * @package: com.xkcoding.rbac.security.payload 11 | * @description: 分页请求参数 12 | * @author: yangkai.shen 13 | * @date: Created in 2018-12-12 18:05 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class PageCondition { 20 | /** 21 | * 当前页码 22 | */ 23 | private Integer currentPage; 24 | 25 | /** 26 | * 每页条数 27 | */ 28 | private Integer pageSize; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /spring-boot-demo-rbac-security/src/main/java/com/xkcoding/rbac/security/repository/UserRoleDao.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.security.repository; 2 | 3 | import com.xkcoding.rbac.security.model.UserRole; 4 | import com.xkcoding.rbac.security.model.unionkey.UserRoleKey; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 7 | 8 | /** 9 | *

10 | * 用户角色 DAO 11 | *

12 | * 13 | * @package: com.xkcoding.rbac.security.repository 14 | * @description: 用户角色 DAO 15 | * @author: yangkai.shen 16 | * @date: Created in 2018-12-10 11:24 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | public interface UserRoleDao extends JpaRepository, JpaSpecificationExecutor { 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot-demo-rbac-security/src/test/java/com/xkcoding/rbac/security/SpringBootDemoRbacSecurityApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.security; 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 SpringBootDemoRbacSecurityApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-rbac-shiro/.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 | .sts4-cache 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-demo-rbac-shiro/src/main/java/com/xkcoding/rbac/shiro/common/IResultCode.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.shiro.common; 2 | 3 | /** 4 | *

5 | * 统一状态码接口 6 | *

7 | * 8 | * @package: com.xkcoding.rbac.shiro.common 9 | * @description: 统一状态码接口 10 | * @author: yangkai.shen 11 | * @date: Created in 2019-03-21 16:28 12 | * @copyright: Copyright (c) 2019 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface IResultCode { 17 | /** 18 | * 获取状态码 19 | * 20 | * @return 状态码 21 | */ 22 | Integer getCode(); 23 | 24 | /** 25 | * 获取返回消息 26 | * 27 | * @return 返回消息 28 | */ 29 | String getMessage(); 30 | } 31 | -------------------------------------------------------------------------------- /spring-boot-demo-rbac-shiro/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | datasource: 7 | hikari: 8 | username: root 9 | password: root 10 | driver-class-name: com.p6spy.engine.spy.P6SpyDriver 11 | url: jdbc:p6spy:mysql://127.0.0.1:3306/spring-boot-demo?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 12 | mybatis-plus: 13 | global-config: 14 | # 关闭banner 15 | banner: false -------------------------------------------------------------------------------- /spring-boot-demo-rbac-shiro/src/main/resources/spy.properties: -------------------------------------------------------------------------------- 1 | module.log=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory 2 | # 自定义日志打印 3 | logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger 4 | #日志输出到控制台 5 | appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger 6 | # 使用日志系统记录 sql 7 | #appender=com.p6spy.engine.spy.appender.Slf4JLogger 8 | # 设置 p6spy driver 代理 9 | deregisterdrivers=true 10 | # 取消JDBC URL前缀 11 | useprefix=true 12 | # 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset. 13 | excludecategories=info,debug,result,batch,resultset 14 | # 日期格式 15 | dateformat=yyyy-MM-dd HH:mm:ss 16 | # 实际驱动可多个 17 | #driverlist=org.h2.Driver 18 | # 是否开启慢SQL记录 19 | outagedetection=true 20 | # 慢SQL记录标准 2 秒 21 | outagedetectioninterval=2 -------------------------------------------------------------------------------- /spring-boot-demo-rbac-shiro/src/test/java/com/xkcoding/rbac/shiro/SpringBootDemoRbacShiroApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.rbac.shiro; 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 SpringBootDemoRbacShiroApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-session/.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 | .sts4-cache 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-demo-session/src/main/java/com/xkcoding/session/SpringBootDemoSessionApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.session; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.session 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-19 19:35 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoSessionApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoSessionApplication.class, args); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /spring-boot-demo-session/src/main/java/com/xkcoding/session/constants/Consts.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.session.constants; 2 | 3 | /** 4 | *

5 | * 常量池 6 | *

7 | * 8 | * @package: com.xkcoding.session.constants 9 | * @description: 常量池 10 | * @author: yangkai.shen 11 | * @date: Created in 2018-12-19 19:42 12 | * @copyright: Copyright (c) 2018 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface Consts { 17 | /** 18 | * session保存的key 19 | */ 20 | String SESSION_KEY = "key:session:token"; 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-demo-session/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | session: 7 | store-type: redis 8 | redis: 9 | flush-mode: immediate 10 | namespace: "spring:session" 11 | redis: 12 | host: localhost 13 | port: 6379 14 | # 连接超时时间(记得添加单位,Duration) 15 | timeout: 10000ms 16 | # Redis默认情况下有16个分片,这里配置具体使用的分片 17 | # database: 0 18 | lettuce: 19 | pool: 20 | # 连接池最大连接数(使用负值表示没有限制) 默认 8 21 | max-active: 8 22 | # 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1 23 | max-wait: -1ms 24 | # 连接池中的最大空闲连接 默认 8 25 | max-idle: 8 26 | # 连接池中的最小空闲连接 默认 0 27 | min-idle: 0 -------------------------------------------------------------------------------- /spring-boot-demo-session/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | spring-boot-demo-session 6 | 7 | 8 | token的值:

9 | 10 | -------------------------------------------------------------------------------- /spring-boot-demo-session/src/main/resources/templates/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | spring-boot-demo-session 6 | 7 | 8 |

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spring-boot-demo-session/src/test/java/com/xkcoding/session/SpringBootDemoSessionApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.session; 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 SpringBootDemoSessionApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-sharding-jdbc/.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 | .sts4-cache 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-demo-sharding-jdbc/src/main/java/com/xkcoding/sharding/jdbc/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.sharding.jdbc.mapper; 2 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; 4 | import com.xkcoding.sharding.jdbc.model.Order; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | *

9 | * 订单表 Mapper 10 | *

11 | * 12 | * @package: com.xkcoding.sharding.jdbc.mapper 13 | * @description: 订单表 Mapper 14 | * @author: yangkai.shen 15 | * @date: Created in 2019-03-26 13:38 16 | * @copyright: Copyright (c) 2019 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @Component 21 | public interface OrderMapper extends BaseMapper { 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-sharding-jdbc/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | mybatis-plus: 2 | global-config: 3 | banner: false 4 | -------------------------------------------------------------------------------- /spring-boot-demo-social/.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 | .sts4-cache 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-demo-social/src/main/java/com/xkcoding/social/SpringBootDemoSocialApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.social; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @author yangkai.shen 12 | * @date Created in 2019-08-09 13:51 13 | */ 14 | @SpringBootApplication 15 | public class SpringBootDemoSocialApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(SpringBootDemoSocialApplication.class, args); 19 | } 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /spring-boot-demo-social/src/test/java/com/xkcoding/social/SpringBootDemoSocialApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.social; 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 SpringBootDemoSocialApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-swagger-beauty/.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 | .sts4-cache 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-demo-swagger-beauty/src/main/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.swagger.beauty; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.swagger.beauty 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-11-28 11:18 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoSwaggerBeautyApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoSwaggerBeautyApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-swagger-beauty/src/test/java/com/xkcoding/swagger/beauty/SpringBootDemoSwaggerBeautyApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.swagger.beauty; 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 SpringBootDemoSwaggerBeautyApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-swagger/.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 | .sts4-cache 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-demo-swagger/src/main/java/com/xkcoding/swagger/SpringBootDemoSwaggerApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.swagger; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.swagger 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-11-29 13:25 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoSwaggerApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoSwaggerApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-swagger/src/main/java/com/xkcoding/swagger/common/ParamType.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.swagger.common; 2 | 3 | /** 4 | *

5 | * 方便在 @ApiImplicitParam 的 paramType 属性使用 6 | *

7 | * 8 | * @package: com.xkcoding.swagger.common 9 | * @description: 方便在 @ApiImplicitParam 的 paramType 属性使用 10 | * @author: yangkai.shen 11 | * @date: Created in 2018-11-29 13:24 12 | * @copyright: Copyright (c) 2018 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public final class ParamType { 17 | 18 | public final static String QUERY = "query"; 19 | public final static String HEADER = "header"; 20 | public final static String PATH = "path"; 21 | public final static String BODY = "body"; 22 | public final static String FORM = "form"; 23 | 24 | } -------------------------------------------------------------------------------- /spring-boot-demo-swagger/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo -------------------------------------------------------------------------------- /spring-boot-demo-swagger/src/test/java/com/xkcoding/swagger/SpringBootDemoSwaggerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.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 SpringBootDemoSwaggerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-task-quartz/.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 | .sts4-cache 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-demo-task-quartz/src/main/java/com/xkcoding/task/quartz/job/HelloJob.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.task.quartz.job; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import com.xkcoding.task.quartz.job.base.BaseJob; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.quartz.JobExecutionContext; 7 | 8 | /** 9 | *

10 | * Hello Job 11 | *

12 | * 13 | * @package: com.xkcoding.task.quartz.job 14 | * @description: Hello Job 15 | * @author: yangkai.shen 16 | * @date: Created in 2018-11-26 13:22 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | @Slf4j 22 | public class HelloJob implements BaseJob { 23 | 24 | @Override 25 | public void execute(JobExecutionContext context) { 26 | log.error("Hello Job 执行时间: {}", DateUtil.now()); 27 | } 28 | } -------------------------------------------------------------------------------- /spring-boot-demo-task-quartz/src/main/java/com/xkcoding/task/quartz/job/TestJob.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.task.quartz.job; 2 | 3 | import cn.hutool.core.date.DateUtil; 4 | import com.xkcoding.task.quartz.job.base.BaseJob; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.quartz.JobExecutionContext; 7 | 8 | /** 9 | *

10 | * Test Job 11 | *

12 | * 13 | * @package: com.xkcoding.task.quartz.job 14 | * @description: Test Job 15 | * @author: yangkai.shen 16 | * @date: Created in 2018-11-26 13:22 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | @Slf4j 22 | public class TestJob implements BaseJob { 23 | 24 | @Override 25 | public void execute(JobExecutionContext context) { 26 | log.error("Test Job 执行时间: {}", DateUtil.now()); 27 | } 28 | } -------------------------------------------------------------------------------- /spring-boot-demo-task-quartz/src/main/java/com/xkcoding/task/quartz/mapper/JobMapper.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.task.quartz.mapper; 2 | 3 | import com.xkcoding.task.quartz.entity.domain.JobAndTrigger; 4 | import org.springframework.stereotype.Component; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

10 | * Job Mapper 11 | *

12 | * 13 | * @package: com.xkcoding.task.quartz.mapper 14 | * @description: Job Mapper 15 | * @author: yangkai.shen 16 | * @date: Created in 2018-11-26 15:12 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | @Component 22 | public interface JobMapper { 23 | /** 24 | * 查询定时作业和触发器列表 25 | * 26 | * @return 定时作业和触发器列表 27 | */ 28 | List list(); 29 | } 30 | -------------------------------------------------------------------------------- /spring-boot-demo-task-quartz/src/test/java/com/xkcoding/task/quartz/SpringBootDemoTaskQuartzApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.task.quartz; 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 SpringBootDemoTaskQuartzApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-task-xxl-job/.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 | .sts4-cache 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-demo-task-xxl-job/src/main/java/com/xkcoding/task/xxl/job/SpringBootDemoTaskXxlJobApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.task.xxl.job; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @author yangkai.shen 12 | * @date Created in 2019-08-07 10:13 13 | */ 14 | @SpringBootApplication 15 | public class SpringBootDemoTaskXxlJobApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(SpringBootDemoTaskXxlJobApplication.class, args); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-demo-task/.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 | .sts4-cache 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-demo-task/src/main/java/com/xkcoding/task/SpringBootDemoTaskApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.task; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.task 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/11/22 19:00 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoTaskApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoTaskApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-task/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | # 下面的配置等同于 TaskConfig 6 | #spring: 7 | # task: 8 | # scheduling: 9 | # pool: 10 | # size: 20 11 | # thread-name-prefix: Job-Thread- -------------------------------------------------------------------------------- /spring-boot-demo-task/src/test/java/com/xkcoding/task/SpringBootDemoTaskApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.task; 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 SpringBootDemoTaskApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-template-beetl/.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 | .sts4-cache 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-demo-template-beetl/src/main/java/com/xkcoding/template/beetl/SpringBootDemoTemplateBeetlApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.beetl; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.template.beetl 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/10 11:17 AM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoTemplateBeetlApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoTemplateBeetlApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-template-beetl/src/main/java/com/xkcoding/template/beetl/model/User.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.beetl.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 用户 model 8 | *

9 | * 10 | * @package: com.xkcoding.template.beetl.model 11 | * @description: 用户 model 12 | * @author: yangkai.shen 13 | * @date: Created in 2018/10/10 11:18 AM 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class User { 20 | private String name; 21 | private String password; 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-template-beetl/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo -------------------------------------------------------------------------------- /spring-boot-demo-template-beetl/src/main/resources/templates/common/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | spring-boot-demo-template-beetl 7 | 8 | 9 | -------------------------------------------------------------------------------- /spring-boot-demo-template-beetl/src/main/resources/templates/page/index.btl: -------------------------------------------------------------------------------- 1 | 2 | 3 | <% include("/common/head.html"){} %> 4 | 5 |
6 | 欢迎登录,${user.name}! 7 |
8 | 9 | -------------------------------------------------------------------------------- /spring-boot-demo-template-beetl/src/main/resources/templates/page/login.btl: -------------------------------------------------------------------------------- 1 | 2 | 3 | <% include("/common/head.html"){} %> 4 | 5 |
6 |
7 | 用户名 8 | 密码 9 | 10 |
11 |
12 | 13 | -------------------------------------------------------------------------------- /spring-boot-demo-template-beetl/src/test/java/com/xkcoding/template/beetl/SpringBootDemoTemplateBeetlApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.beetl; 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 SpringBootDemoTemplateBeetlApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-template-enjoy/.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 | .sts4-cache 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-demo-template-enjoy/src/main/java/com/xkcoding/template/enjoy/SpringBootDemoTemplateEnjoyApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.enjoy; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.template.enjoy 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/11 2:06 PM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoTemplateEnjoyApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoTemplateEnjoyApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-template-enjoy/src/main/java/com/xkcoding/template/enjoy/model/User.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.enjoy.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 用户 model 8 | *

9 | * 10 | * @package: com.xkcoding.template.enjoy.model 11 | * @description: 用户 model 12 | * @author: yangkai.shen 13 | * @date: Created in 2018/10/11 2:21 PM 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class User { 20 | private String name; 21 | private String password; 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-template-enjoy/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo -------------------------------------------------------------------------------- /spring-boot-demo-template-enjoy/src/main/resources/templates/common/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | spring-boot-demo-template-enjoy 7 | 8 | 9 | -------------------------------------------------------------------------------- /spring-boot-demo-template-enjoy/src/main/resources/templates/page/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include("/common/head.html") 4 | 5 |
6 | 欢迎登录,#(user.name)! 7 |
8 | 9 | -------------------------------------------------------------------------------- /spring-boot-demo-template-enjoy/src/main/resources/templates/page/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include("/common/head.html") 4 | 5 |
6 |
7 | 用户名 8 | 密码 9 | 10 |
11 |
12 | 13 | -------------------------------------------------------------------------------- /spring-boot-demo-template-enjoy/src/test/java/com/xkcoding/template/enjoy/SpringBootDemoTemplateEnjoyApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.enjoy; 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 SpringBootDemoTemplateEnjoyApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-template-freemarker/.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 | .sts4-cache 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-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/SpringBootDemoTemplateFreemarkerApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.freemarker; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.template.freemarker 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/9 3:17 PM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoTemplateFreemarkerApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoTemplateFreemarkerApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-template-freemarker/src/main/java/com/xkcoding/template/freemarker/model/User.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.freemarker.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 用户 model 8 | *

9 | * 10 | * @package: com.xkcoding.template.freemarker.model 11 | * @description: 用户 model 12 | * @author: yangkai.shen 13 | * @date: Created in 2018/10/9 3:06 PM 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class User { 20 | private String name; 21 | private String password; 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-template-freemarker/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | freemarker: 7 | suffix: .ftl 8 | cache: false 9 | charset: UTF-8 -------------------------------------------------------------------------------- /spring-boot-demo-template-freemarker/src/main/resources/templates/common/head.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | spring-boot-template-freemarker 7 | -------------------------------------------------------------------------------- /spring-boot-demo-template-freemarker/src/main/resources/templates/page/index.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | <#include "../common/head.ftl"> 4 | 5 |
6 | 欢迎登录,${user.name}! 7 |
8 | 9 | -------------------------------------------------------------------------------- /spring-boot-demo-template-freemarker/src/main/resources/templates/page/login.ftl: -------------------------------------------------------------------------------- 1 | 2 | 3 | <#include "../common/head.ftl"> 4 | 5 |
6 |
7 | 用户名 8 | 密码 9 | 10 |
11 |
12 | 13 | -------------------------------------------------------------------------------- /spring-boot-demo-template-freemarker/src/test/java/com/xkcoding/template/freemarker/SpringBootDemoTemplateFreemarkerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.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 SpringBootDemoTemplateFreemarkerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-template-thymeleaf/.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 | .sts4-cache 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-demo-template-thymeleaf/src/main/java/com/xkcoding/template/thymeleaf/SpringBootDemoTemplateThymeleafApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.thymeleaf; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.template.thymeleaf 12 | * @description: 启动类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018/10/10 10:10 AM 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoTemplateThymeleafApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoTemplateThymeleafApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-template-thymeleaf/src/main/java/com/xkcoding/template/thymeleaf/model/User.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.thymeleaf.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 用户 model 8 | *

9 | * 10 | * @package: com.xkcoding.template.thymeleaf.model 11 | * @description: 用户 model 12 | * @author: yangkai.shen 13 | * @date: Created in 2018/10/10 10:11 AM 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class User { 20 | private String name; 21 | private String password; 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-demo-template-thymeleaf/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | spring: 6 | thymeleaf: 7 | mode: HTML 8 | encoding: UTF-8 9 | servlet: 10 | content-type: text/html 11 | cache: false -------------------------------------------------------------------------------- /spring-boot-demo-template-thymeleaf/src/main/resources/templates/common/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | spring-boot-demo-template-thymeleaf 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /spring-boot-demo-template-thymeleaf/src/main/resources/templates/page/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 | 欢迎登录,! 7 |
8 | 9 | -------------------------------------------------------------------------------- /spring-boot-demo-template-thymeleaf/src/main/resources/templates/page/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
6 |
7 | 用户名 8 | 密码 9 | 10 |
11 |
12 | 13 | -------------------------------------------------------------------------------- /spring-boot-demo-template-thymeleaf/src/test/java/com/xkcoding/template/thymeleaf/SpringBootDemoTemplateThymeleafApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.template.thymeleaf; 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 SpringBootDemoTemplateThymeleafApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-tio/.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 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /nbbuild/ 22 | /dist/ 23 | /nbdist/ 24 | /.nb-gradle/ 25 | /build/ 26 | -------------------------------------------------------------------------------- /spring-boot-demo-tio/README.md: -------------------------------------------------------------------------------- 1 | # spring-boot-demo-tio -------------------------------------------------------------------------------- /spring-boot-demo-tio/src/main/java/com/xkcoding/springbootdemotio/SpringBootDemoTioApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.springbootdemotio; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.springbootdemotio 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-02-05 18:58 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoTioApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoTioApplication.class, args); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /spring-boot-demo-tio/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-tio/src/main/resources/application.properties -------------------------------------------------------------------------------- /spring-boot-demo-tio/src/test/java/com/xkcoding/springbootdemotio/SpringBootDemoTioApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.springbootdemotio; 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 SpringBootDemoTioApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-uflo/.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 | .sts4-cache 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-demo-uflo/src/main/java/com/xkcoding/uflo/SpringBootDemoUfloApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.uflo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SpringBootDemoUfloApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SpringBootDemoUfloApplication.class, args); 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /spring-boot-demo-uflo/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-uflo/src/main/resources/application.properties -------------------------------------------------------------------------------- /spring-boot-demo-uflo/src/test/java/com/xkcoding/uflo/SpringBootDemoUfloApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.uflo; 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 SpringBootDemoUfloApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-upload/.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 | .sts4-cache 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-demo-upload/src/main/java/com/xkcoding/upload/SpringBootDemoUploadApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.upload; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动类 9 | *

10 | * 11 | * @package: com.xkcoding.upload 12 | * @description: 启动类 13 | * @author: shenyangkai 14 | * @date: Created in 2018/10/20 21:23 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: shenyangkai 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoUploadApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoUploadApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-upload/src/main/java/com/xkcoding/upload/controller/IndexController.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.upload.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | /** 7 | *

8 | * 首页Controller 9 | *

10 | * 11 | * @package: com.xkcoding.upload.controller 12 | * @description: 首页Controller 13 | * @author: shenyangkai 14 | * @date: Created in 2018/10/20 21:22 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: shenyangkai 18 | */ 19 | @Controller 20 | public class IndexController { 21 | @GetMapping("") 22 | public String index() { 23 | return "index"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-upload/src/main/java/com/xkcoding/upload/service/IQiNiuService.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.upload.service; 2 | 3 | import com.qiniu.common.QiniuException; 4 | import com.qiniu.http.Response; 5 | 6 | import java.io.File; 7 | 8 | /** 9 | *

10 | * 七牛云上传Service 11 | *

12 | * 13 | * @package: com.xkcoding.upload.service 14 | * @description: 七牛云上传Service 15 | * @author: yangkai.shen 16 | * @date: Created in 2018/11/6 17:21 17 | * @copyright: Copyright (c) 2018 18 | * @version: V1.0 19 | * @modified: yangkai.shen 20 | */ 21 | public interface IQiNiuService { 22 | /** 23 | * 七牛云上传文件 24 | * 25 | * @param file 文件 26 | * @return 七牛上传Response 27 | * @throws QiniuException 七牛异常 28 | */ 29 | Response uploadFile(File file) throws QiniuException; 30 | } 31 | -------------------------------------------------------------------------------- /spring-boot-demo-upload/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | qiniu: 6 | ## 此处填写你自己的七牛云 access key 7 | accessKey: 8 | ## 此处填写你自己的七牛云 secret key 9 | secretKey: 10 | ## 此处填写你自己的七牛云 bucket 11 | bucket: 12 | ## 此处填写你自己的七牛云 域名 13 | prefix: 14 | spring: 15 | servlet: 16 | multipart: 17 | enabled: true 18 | location: /Users/yangkai.shen/Documents/code/back-end/spring-boot-demo/spring-boot-demo-upload/tmp 19 | file-size-threshold: 5MB 20 | max-file-size: 20MB -------------------------------------------------------------------------------- /spring-boot-demo-upload/src/test/java/com/xkcoding/upload/SpringBootDemoUploadApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.upload; 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 SpringBootDemoUploadApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-ureport2/.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 | .sts4-cache 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-demo-ureport2/src/main/java/com/xkcoding/ureport2/SpringBootDemoUreport2Application.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ureport2; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.ureport2 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-02-26 23:56 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoUreport2Application { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoUreport2Application.class, args); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /spring-boot-demo-ureport2/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-ureport2/src/main/resources/application.properties -------------------------------------------------------------------------------- /spring-boot-demo-ureport2/src/test/java/com/xkcoding/ureport2/SpringBootDemoUreport2ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.ureport2; 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 SpringBootDemoUreport2ApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-urule/.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 | .sts4-cache 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-demo-urule/src/main/java/com/xkcoding/urule/SpringBootDemoUruleApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.urule; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.urule 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2019-02-25 22:46 15 | * @copyright: Copyright (c) 2019 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoUruleApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoUruleApplication.class, args); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /spring-boot-demo-urule/src/main/resources/application.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zzyybs/spring-boot-demo/af6971068bc163e476960365be35044e8120817f/spring-boot-demo-urule/src/main/resources/application.properties -------------------------------------------------------------------------------- /spring-boot-demo-urule/src/test/java/com/xkcoding/urule/SpringBootDemoUruleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.urule; 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 SpringBootDemoUruleApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-war/.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 | .sts4-cache 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-demo-war/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo -------------------------------------------------------------------------------- /spring-boot-demo-war/src/test/java/com/xkcoding/war/SpringBootDemoWarApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.war; 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 SpringBootDemoWarApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/.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 | .sts4-cache 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-demo-websocket-socketio/src/main/java/com/xkcoding/websocket/socketio/SpringBootDemoWebsocketSocketioApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.socketio; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.websocket.socketio 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-12 13:59 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoWebsocketSocketioApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoWebsocketSocketioApplication.class, args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/src/main/java/com/xkcoding/websocket/socketio/config/Event.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.socketio.config; 2 | 3 | /** 4 | *

5 | * 事件常量 6 | *

7 | * 8 | * @package: com.xkcoding.websocket.socketio.config 9 | * @description: 事件常量 10 | * @author: yangkai.shen 11 | * @date: Created in 2018-12-18 19:36 12 | * @copyright: Copyright (c) 2018 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface Event { 17 | /** 18 | * 聊天事件 19 | */ 20 | String CHAT = "chat" ; 21 | 22 | /** 23 | * 广播消息 24 | */ 25 | String BROADCAST = "broadcast" ; 26 | 27 | /** 28 | * 群聊 29 | */ 30 | String GROUP = "group" ; 31 | 32 | /** 33 | * 加入群聊 34 | */ 35 | String JOIN = "join" ; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/src/main/java/com/xkcoding/websocket/socketio/config/WsConfig.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.socketio.config; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | 6 | /** 7 | *

8 | * WebSocket配置类 9 | *

10 | * 11 | * @package: com.xkcoding.websocket.socketio.config 12 | * @description: WebSocket配置类 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-18 16:41 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @ConfigurationProperties(prefix = "ws.server") 20 | @Data 21 | public class WsConfig { 22 | /** 23 | * 端口号 24 | */ 25 | private Integer port; 26 | 27 | /** 28 | * host 29 | */ 30 | private String host; 31 | } 32 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/src/main/java/com/xkcoding/websocket/socketio/payload/BroadcastMessageRequest.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.socketio.payload; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 广播消息载荷 8 | *

9 | * 10 | * @package: com.xkcoding.websocket.socketio.payload 11 | * @description: 广播消息载荷 12 | * @author: yangkai.shen 13 | * @date: Created in 2018-12-18 20:01 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class BroadcastMessageRequest { 20 | /** 21 | * 消息内容 22 | */ 23 | private String message; 24 | } 25 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/src/main/java/com/xkcoding/websocket/socketio/payload/GroupMessageRequest.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.socketio.payload; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 群聊消息载荷 8 | *

9 | * 10 | * @package: com.xkcoding.websocket.socketio.payload 11 | * @description: 群聊消息载荷 12 | * @author: yangkai.shen 13 | * @date: Created in 2018-12-18 16:59 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class GroupMessageRequest { 20 | /** 21 | * 消息发送方用户id 22 | */ 23 | private String fromUid; 24 | 25 | /** 26 | * 群组id 27 | */ 28 | private String groupId; 29 | 30 | /** 31 | * 消息内容 32 | */ 33 | private String message; 34 | } 35 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/src/main/java/com/xkcoding/websocket/socketio/payload/JoinRequest.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.socketio.payload; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 加群载荷 8 | *

9 | * 10 | * @package: com.xkcoding.websocket.socketio.payload 11 | * @description: 加群载荷 12 | * @author: yangkai.shen 13 | * @date: Created in 2018-12-19 13:36 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class JoinRequest { 20 | /** 21 | * 用户id 22 | */ 23 | private String userId; 24 | 25 | /** 26 | * 群名称 27 | */ 28 | private String groupId; 29 | } 30 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/src/main/java/com/xkcoding/websocket/socketio/payload/SingleMessageRequest.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.socketio.payload; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | *

7 | * 私聊消息载荷 8 | *

9 | * 10 | * @package: com.xkcoding.websocket.socketio.payload 11 | * @description: 私聊消息载荷 12 | * @author: yangkai.shen 13 | * @date: Created in 2018-12-18 17:02 14 | * @copyright: Copyright (c) 2018 15 | * @version: V1.0 16 | * @modified: yangkai.shen 17 | */ 18 | @Data 19 | public class SingleMessageRequest { 20 | /** 21 | * 消息发送方用户id 22 | */ 23 | private String fromUid; 24 | 25 | /** 26 | * 消息接收方用户id 27 | */ 28 | private String toUid; 29 | 30 | /** 31 | * 消息内容 32 | */ 33 | private String message; 34 | } 35 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | ws: 6 | server: 7 | port: 8081 8 | host: localhost -------------------------------------------------------------------------------- /spring-boot-demo-websocket-socketio/src/test/java/com/xkcoding/websocket/socketio/SpringBootDemoWebsocketSocketioApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.socketio; 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 SpringBootDemoWebsocketSocketioApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket/.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 | .sts4-cache 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-demo-websocket/src/main/java/com/xkcoding/websocket/common/WebSocketConsts.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.common; 2 | 3 | /** 4 | *

5 | * WebSocket常量 6 | *

7 | * 8 | * @package: com.xkcoding.websocket.common 9 | * @description: WebSocket常量 10 | * @author: yangkai.shen 11 | * @date: Created in 2018-12-14 16:01 12 | * @copyright: Copyright (c) 2018 13 | * @version: V1.0 14 | * @modified: yangkai.shen 15 | */ 16 | public interface WebSocketConsts { 17 | String PUSH_SERVER = "/topic/server"; 18 | } 19 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket/src/main/java/com/xkcoding/websocket/payload/KV.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket.payload; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | *

9 | * 键值匹配 10 | *

11 | * 12 | * @package: com.xkcoding.websocket.payload 13 | * @description: 键值匹配 14 | * @author: yangkai.shen 15 | * @date: Created in 2018-12-14 17:41 16 | * @copyright: Copyright (c) 2018 17 | * @version: V1.0 18 | * @modified: yangkai.shen 19 | */ 20 | @Data 21 | @AllArgsConstructor 22 | @NoArgsConstructor 23 | public class KV { 24 | /** 25 | * 键 26 | */ 27 | private String key; 28 | 29 | /** 30 | * 值 31 | */ 32 | private Object value; 33 | } 34 | -------------------------------------------------------------------------------- /spring-boot-demo-websocket/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo -------------------------------------------------------------------------------- /spring-boot-demo-websocket/src/test/java/com/xkcoding/websocket/SpringBootDemoWebsocketApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.websocket; 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 SpringBootDemoWebsocketApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | 18 | -------------------------------------------------------------------------------- /spring-boot-demo-zookeeper/.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 | .sts4-cache 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-demo-zookeeper/src/main/java/com/xkcoding/zookeeper/SpringBootDemoZookeeperApplication.java: -------------------------------------------------------------------------------- 1 | package com.xkcoding.zookeeper; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

8 | * 启动器 9 | *

10 | * 11 | * @package: com.xkcoding.zookeeper 12 | * @description: 启动器 13 | * @author: yangkai.shen 14 | * @date: Created in 2018-12-27 14:51 15 | * @copyright: Copyright (c) 2018 16 | * @version: V1.0 17 | * @modified: yangkai.shen 18 | */ 19 | @SpringBootApplication 20 | public class SpringBootDemoZookeeperApplication { 21 | 22 | public static void main(String[] args) { 23 | SpringApplication.run(SpringBootDemoZookeeperApplication.class, args); 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /spring-boot-demo-zookeeper/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8080 3 | servlet: 4 | context-path: /demo 5 | 6 | zk: 7 | url: 127.0.0.1:2181 8 | timeout: 1000 9 | retry: 3 10 | --------------------------------------------------------------------------------