该项目已成功集成 actuator(监控)、admin(可视化监控)、logback(日志)、aopLog(通过AOP记录web请求日志)、统一异常处理(json级别和页面级别)、freemarker(模板引擎)、thymeleaf(模板引擎)、Beetl(模板引擎)、Enjoy(模板引擎)、JdbcTemplate(通用JDBC操作数据库)、JPA(强大的ORM框架)、mybatis(强大的ORM框架)、通用Mapper(快速操作Mybatis)、PageHelper(通用的Mybatis分页插件)、mybatis-plus(快速操作Mybatis)、BeetlSQL(强大的ORM框架)、upload(本地文件上传和七牛云文件上传)、redis(缓存)、ehcache(缓存)、email(发送各种类型邮件)、task(基础定时任务)、quartz(动态管理定时任务)、xxl-job(分布式定时任务)、swagger(API接口管理测试)、security(基于RBAC的动态权限认证)、SpringSession(Session共享)、Zookeeper(结合AOP实现分布式锁)、RabbitMQ(消息队列)、Kafka(消息队列)、websocket(服务端推送监控服务器运行信息)、socket.io(聊天室)、ureport2(中国式报表)、打包成war文件、集成 ElasticSearch(基本操作和高级查询)、Async(异步任务)、集成Dubbo(采用官方的starter)、MongoDB(文档数据库)、neo4j(图数据库)、docker(容器化)、JPA多数据源、Mybatis多数据源、代码生成器、GrayLog(日志收集)、JustAuth(第三方登录)、LDAP(增删改查)、动态添加/切换数据源、单机限流(AOP + Guava RateLimiter)、分布式限流(AOP + Redis + Lua)、ElasticSearch 7.x(使用官方 Rest High Level Client)、HTTPS、Flyway(数据库初始化)、UReport2(中国式复杂报表)。
English | 中文
spring boot demo
is a project for learning and practicing spring boot
, including 66
demos, and 55
of them have been done.
This project has integrated actuator (monitoring
), admin (visual monitoring
), logback (log
), aopLog (recording web request logs through AOP
), global exception handling (json level and page level
), freemarker (template engine
), thymeleaf (template engine
), Beetl (template engine
), Enjoy (template engine
), JdbcTemplate (general JDBC operate database
), JPA (powerful ORM framework
), mybatis (powerful ORM framework
), Generic Mapper (mybatis quick operation
), PageHelper (powerful mybatis pagination plugin
), mybatis-plus (mybatis quick operation
), BeetlSQL (powerful ORM framework
), upload (local file upload and qiniu cloud file upload
), redis (cache
), ehcache (cache
), email (send various types of mail
), task (basic scheduled tasks
), quartz (dynamic management scheduled tasks
), xxl-job (distributed scheduled tasks
), swagger (API interface management and tests
), security (RBAC-based Dynamic Rights Authentication
), SpringSession (session sharing
), Zookeeper (implement distributed locks by AOP
), RabbitMQ (message queue
), Kafka (message queue
), websocket (server pushes the monitoring server status to front end
), socket.io (chat room
), ureport2 (Chinese-style report
), packaged into a war
file, integrate ElasticSearch (basic operations and advanced queries
), Async ( asynchronous tasks
), integrated Dubbo (with official starter
), MongoDB (document database
), neo4j (graph database
), docker (container
), JPA Multi-Datasource
, Mybatis Multi-Datasource
, code generator
’, GrayLog (log collection
), JustAuth (third-party login
), LDAP(CURD
), Dynamically add/switch datasources
, Standalone RateLimiting(AOP + Guava RateLimiter
), Distributed Ratelimiting(AOP + Redis + Lua
), ElasticSearch 7.x(use official Rest High Level Client
), HTTPS, Flyway(initialize databases
),UReport2(Chinese complex report
).
If you have demos to contribute or needs to meet, it is very welcome to submit a issue and I will add it to my TODO list.
2.1.0.RELEASE
. Every module’s parent dependency is the pom.xml at root directory in convenience of managing common dependencies and learning spring boot.1.5.8.RELEASE
. Every module’s parent dependency is spring-boot-demo-parent. But since the feedback shows that it is not much friendly to many new learners, this branch will not be mantained any more. All of the demos will be moved to branch master. Everyone could still study at this branch but it’s suggested to study at branch master while Spring Boot has much new content over version 2.x
.lombok
installed.)Note: If you has been forked this project, need to sync the project’s code, please see: https://xkcoding.com/2018/09/18/how-to-update-the-fork-project.html
git clone https://github.com/xkcoding/spring-boot-demo.git
pom.xml
file from the root directory using Maven Projects
panelMaven Projects
panel, try to tick View -> Tool Buttons
on and the Maven Projects
panel will appear on the right side of IDEA.Note: Each demo has a detailed README file. Remember to check it before running the demo~
Note: In some condition you have to execute sql to prepare data before running demo, don't forget it~
JustAuth
:The most comprehensive open source library for third-party logins in history,https://github.com/justauth/JustAuthMica
:Spring Boot microservices efficient development toolset,https://github.com/lets-mica/micaawesome-collector
:https://github.com/P-P-X/awesome-collectorSpringBlade
:Complete micro-service online solution (required for enterprise development),https://github.com/chillzhuang/SpringBladePig
:The universe’s strongest micro-service certification authorized scaffolding (architect necessary),https://github.com/pigxcloud/pigView the TODO file
Module Name | Module Description |
---|---|
demo-helloworld | a helloworld demo. |
demo-properties | a demo to read the contents of configuration file. |
demo-actuator | a demo to integrate spring-boot-starter-actuator for monitoring the starting status and the running status of application. |
demo-admin-client | a client demo to integrate spring-boot-admin for visually monitoring the running status of application, it can be used with spring-boot-starter-actuator. |
demo-admin-server | a server demo to integrate spring-boot-admin for visually monitoring the running status of the spring-boot program, it can be used with spring-boot-starter-actuator. |
demo-logback | a demo to integrate the logback for logging. |
demo-log-aop | a demo to record web request logs using AOP aspect. |
demo-exception-handler | a demo to demonstrate global exception handling, including 2 types, the first one returns json data, and the second one jumps to error page. |
demo-template-freemarker | a demo to integrate Freemarker template engine. |
demo-template-thymeleaf | a demo to integrate Thymeleaf template engine. |
demo-template-beetl | a demo to integrate Beetl template engine. |
demo-template-enjoy | a demo to integrate Enjoy template engine. |
demo-orm-jdbctemplate | a demo to integrate the Jdbc Template for operating database and easily encapsulate the generic Dao layer. |
demo-orm-jpa | a demo to integrate spring-boot-starter-data-jpa for operating database. |
demo-orm-mybatis | a demo to integrate native mybatis by using mybatis-spring-boot-starter dependency. |
demo-orm-mybatis-mapper-page | a demo to integrate Mapper and PageHelper by using mapper-spring-boot-starter and pagehelper-spring-boot-starter dependencies. |
demo-orm-mybatis-plus | a demo to integrate mybatis-plus by using mybatis-plus-boot-starter dependency, integrate BaseMapper / BaseService / ActiveRecord to operate database. |
demo-orm-beetlsql | a demo to integrate beetl-sql by using beetl-framework-starter dependency. |
demo-upload | a file upload demo, including local file upload and qiniu cloud file upload. |
demo-cache-redis | a demo to integrate redis, operate data in redis, and use redis to cache data. |
demo-cache-ehcache | a demo to integrate ehcache, and use ehcache to cache data. |
demo-email | a demo to integrate email, including sending simple text email, HTML email (including template HTML email), attachment email, and static resource email. |
demo-task | a demo to show easy to use scheduled task. |
demo-task-quartz | a demo to integrate quartz for managing scheduled tasks, including adding new scheduled tasks, deleting scheduled tasks, suspending scheduled tasks, restoring scheduled tasks, modifying scheduled task startup times, and timing task list queries, and providing front-end pages . |
demo-task-xxl-job | a demo to integrate xxl-job for distributed scheduled tasks and provide methods to manage scheduled tasks bypass xxl-job-admin , including scheduled task lists, trigger lists, new scheduled tasks, deleted scheduled tasks, stopped scheduled tasks, and started scheduled tasks. Modify the scheduled task and manually trigger the scheduled task. |
demo-swagger | a demo to integrate native swagger to manage and test API interfaces. |
demo-swagger-beauty | a demo to integrate third part of swagger dependency swagger-bootstrap-ui to beautify document style and manage and test API interfaces. |
demo-rbac-security | a demo to integrate spring security implement privilege management based on RBAC privilege model, supports custom filtering request, dynamic privilege authentication, uses JWT security authentication, supports online population statistics, manually kicks out users, etc. |
demo-rbac-shiro | NOT FINISHED YET! a demo to integrate shiro for authentication management. |
demo-session | a demo to integrate Spring Session to implement Session sharing, restart program Session does not expire. |
demo-oauth | NOT FINISHED YET! a demo to implement the oauth server and to implement oauth2 protocol such as the authorization code, access token. |
demo-social | a demo to integrate third-party login by using justauth-spring-boot-starter dependency to achieve QQ login, GitHub login, WeChat login, Google login, Microsoft login, Xiaomi login, enterprise WeChat login. |
demo-zookeeper | a demo to integrate Zookeeper and AOP to implement distributed lock. |
demo-mq-rabbitmq | a demo to integrate RabbitMQ implementation for message delivery and reception based on direct queue mode, fanout mode, topic mode, delay queue. |
demo-mq-rocketmq | NOT FINISHED YET! a demo to integrate RocketMQ implementation for message delivery and reception. |
demo-mq-kafka | a demo to integrate Kafka implementation for message delivery and reception. |
demo-websocket | a demo to integrate websocket, the backend actively pushes the server running status to front end. |
demo-websocket-socketio | a demo to integrate websocket by using netty-socketio , implement a simple chat room. |
demo-ureport2 | NOT FINISHED YET! a demo to integrate ureport2 to implement complex, customized Chinese-style reports. |
demo-uflo | NOT FINISHED YET! a demo to integrate uflo(process engine like Activiti and Flowable) to quickly implement a lightweight process engine. |
demo-urule | NOT FINISHED YET! a demo to integrate urule(rule engine like drools) fast implementation rule engine. |
demo-activiti | NOT FINISHED YET! a demo to integrate Activiti 7 process engine. |
demo-async | asynchronous execution of tasks by using natively provided asynchronous task support. |
demo-war | packaged into a war format configuration |
demo-elasticsearch | a demo to integrate ElasticSearch by using spring-boot-starter-data-elasticsearch to implement advanced techniques for using ElasticSearch, including creating indexes, configuring mappings, deleting indexes, adding and deleting basic operations, complex queries, advanced queries, aggregate queries, etc. |
demo-dubbo | a demo to integrate Dubbo, common module spring-boot-demo-dubbo-common , service provider spring-boot-demo-dubbo-provider , service consumer spring-boot-demo-dubbo-consumer . |
demo-mongodb | a demo to integrate MongoDB and use the official starter to CRUD. |
demo-neo4j | a demo to integrate Neo4j graph database to implement a campus character relationship network. |
demo-docker | docker container. |
demo-multi-datasource-jpa | a demo to implement JPA multi-datasource. |
demo-multi-datasource-mybatis | a demo to implement Mybatis multi-datasource by using an open source solution from Mybatis-Plus. |
demo-sharding-jdbc | a demo to use sharding-jdbc to implement sub-database and sub-tables, while ORM uses Mybatis-Plus. |
demo-tio | NOT FINISHED YET! a demo to integrate t-io(a network programming framework like netty). |
demo-grpc | NOT FINISHED YET! a demo to integrate Google grpc, need to be configure tls/ssl, see ISSUE#5. |
demo-codegen | a demo to integrate velocity template engine to implement code generator, improve development efficiency. |
demo-graylog | a demo to integrate graylog for unified log collection. |
demo-sso | NOT FINISHED YET! a demo to integrate Single Sign On, see ISSUE#12. |
demo-ldap | a demo to integrate LDAP to use spring-boot-starter-data-ldap to implement CURD operations and give the login demo, see ISSUE#23, thanks @fxbin. |
demo-dynamic-datasource | a demo to add datasource dynamically, switch datasource dynamically. |
demo-ratelimit-guava | a demo to use use Guava RateLimiter to protect API by standalone rate limiting. |
demo-ratelimit-redis | a demo to use Redis and Lua script implementation to protect API by distributed rate limiting. |
demo-https | a demo to integrate HTTPS. |
demo-elasticsearch-rest-high-level-client | a demo to integrate ElasticSearch 7.x version by using official Rest High Level Client to operate ES data. |
demo-flyway | a demo to integrate Flyway to initialize tables and data in database, Flyway also support the sql script version control. |
demo-ureport2 | a demo to integrate Ureport2 to design the Chinese complex report file. |
Copyright © 2018 Yangkai.Shen