Spring-boot-plus is a quick backend development framework that integrates spring Boot common development components
Spring-boot-plus is an easy to use, fast, efficient, feature-rich, open source Spring Boot scaffolding.
The front and back ends are separated to focus on back-end services
The target
Everyone can develop projects independently, quickly and efficiently!
repository
GITHUB | GITEE
website
springboot.plus
The main features
- Integrate spring Boot common development component sets, common configurations, AOP logs, and so on
- Integrate MyBatis Plus for fast DAO operation
- Quickly generate code: the entity/param/vo/controller/service/mapper/XML
- Integrate Swagger2 for automatic API documentation generation
- Integrated JWT, Shiro/Spring Security permission control
- Integrated Redis, Spring Cache, ehCache cache
- Integrate rabbit/ Rocket/Kafka MQ message queues
- Integrates DruID connection pooling, JDBC performance, and slow query detection
- Integrated with Spring Boot Admin, real-time detection of project running status
- Use the Assembly Maven plug-in to package and deploy different environments, including startup and restart commands, and extract configuration files to an external Config directory
The project architecture
Project environment
The middleware | version | note |
---|---|---|
JDK | 1.8 + | JDK1.8 and above |
MySQL | 5.7 + | 5.7 and above |
Redis | 3.2 + |
Technology selection
technology | version | note |
---|---|---|
Spring Boot | 2.2.0. RELEASE | Latest stable release |
Spring Framework | 5.2.0. RELEASE | Latest stable release |
Mybatis | 3.5.2 | Persistence layer frame |
Mybatis Plus | 3.2.0 | Mybatis enhanced framework |
Alibaba Druid | 1.1.20 | The data source |
Fastjson | 1.2.62 | JSON processing tool set |
swagger2 | 2.6.1 | API document generation tool |
commons-lang3 | 3.9 | Common tool kit |
commons-io | 2.6 | IO toolkit |
commons-codec | 1.13 | Encryption decryption tool kit |
commons-collections4 | 4.4 | Collection kit |
reflections | 0.9.11 | Reflector kit |
hibernate-validator | 6.0.17. The Final | Background parameter verification annotation |
Shiro | 1.4.1 | Access control |
JWT | 3.8.3 | JSON WEB TOKEN |
hutool-all | 5.0.3 | Common Tool set |
lombok | 1.18.10 | Annotations generate Java beans and other tools |
mapstruct | 1.3.1. The Final | Object property replication tool |
CHANGELOG
CHANGELOG.md
Java Docs
Java Api Docs
use
Cloning of spring – the boot – plus
git clone https://github.com/geekidea/spring-boot-plus.git
cd spring-boot-plus
Copy the code
Maven build
By default, the local environment is used. The corresponding configuration file is application-local.yml
mvn clean package -Plocal
Copy the code
Add, delete, change and check in 5 minutes
1. Create a database table
-- ----------------------------
-- Table structure for foo_bar
-- ----------------------------
DROP TABLE IF EXISTS `foo_bar`;
CREATE TABLE `foo_bar`
(
`id` bigint(20) NOT NULL COMMENT 'primary key'.`name` varchar(20) NOT NULL COMMENT 'name'.`foo` varchar(20) DEFAULT NULL COMMENT 'Foo'.`bar` varchar(20) NOT NULL COMMENT 'Bar'.`remark` varchar(200) DEFAULT NULL COMMENT 'note'.`state` int(11) NOT NULL DEFAULT '1' COMMENT 'Status, 0: disabled, 1: enabled'.`version` int(11) NOT NULL DEFAULT '0' COMMENT 'version'.`create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Creation time'.`update_time` timestamp NULL DEFAULT NULL COMMENT 'Modification time',
PRIMARY KEY (`id`))ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='FooBar';
-- ----------------------------
-- Records of foo_bar
-- ----------------------------
INSERT INTO foo_bar (id.name, foo, bar, remark, state, version, create_time, update_time)
VALUES (1.'FooBar'.'foo'.'bar'.'remark... '.1.0.'the 2019-11-01 14:05:14'.null);
INSERT INTO foo_bar (id.name, foo, bar, remark, state, version, create_time, update_time)
VALUES (2.'HelloWorld'.'hello'.'world'.null.1.0.'the 2019-11-01 14:05:14'.null);
Copy the code
2. Use code generator to generate add, delete, change and check code
Modifying database Information
Modify component name/author/database table name/primary key ID
/src/test/java/io/geekidea/springbootplus/test/SpringBootPlusGenerator.java
Copy the code
/** * Spring-boot-plus code generator entry class **@author geekidea
* @dateThe 2019-10-22 * * /
public class SpringBootPlusGenerator {
public static void main(String[] args) {
CodeGenerator codeGenerator = new CodeGenerator();
// Public configuration
// Database configuration
codeGenerator
.setUserName("root")
.setPassword("root")
.setDriverName("com.mysql.jdbc.Driver")
.setDriverUrl("jdbc:mysql://localhost:3306/spring_boot_plus? useUnicode=true&characterEncoding=UTF-8&useSSL=false");
/ / package information
codeGenerator
.setProjectPackagePath("io/geekidea/springbootplus")
.setParentPackage("io.geekidea.springbootplus");
// Component author and other configurations
codeGenerator
.setModuleName("foobar")
.setAuthor("geekidea")
.setPkIdColumnName("id");
// Generate a policy
codeGenerator
.setGeneratorStrategy(CodeGenerator.GeneratorStrategy.ALL)
.setPageListOrder(true)
.setParamValidation(true);
// Generate entity mapping code that can be used for database field updates
// You can customize which files are generated automatically when database fields are updated
codeGenerator
.setGeneratorEntity(true)
.setGeneratorQueryParam(true)
.setGeneratorQueryVo(true);
// Generate business related code
codeGenerator
.setGeneratorController(true)
.setGeneratorService(true)
.setGeneratorServiceImpl(true)
.setGeneratorMapper(true)
.setGeneratorMapperXml(true);
// Whether to generate the Shiro RequiresPermissions annotation
codeGenerator.setRequiresPermissions(false);
// Whether to overwrite existing files
codeGenerator.setFileOverride(true);
// Initialize the public variable
codeGenerator.init();
// An array of tables to be generated
// XXX,yyy, ZZZ are the names of the tables whose code needs to be generated
String[] tables = {
"foo_bar"
};
// loop generation
for (String table : tables) {
// Set the name of the table to be generated
codeGenerator.setTableName(table);
// Generate codecodeGenerator.generator(); }}}Copy the code
Generated code structure
/src/main/java/io/geekidea/springbootplus/foobar
Copy the code
├─ ├─ all exercises, ├─ all exercises, all exercises, all exercises ├ ─ ─ param │ └ ─ ─ FooBarQueryParam. Java ├ ─ ─ service │ ├ ─ ─ FooBarService. Java │ └ ─ ─ impl │ └ ─ ─ FooBarServiceImpl. Java └ ─ ─ Vo └ ─ ─ FooBarQueryVo. JavaCopy the code
Mapper XML
/src/main/resources/mapper/foobar/FooBarMapper.xml
Copy the code
3. Start the project
Project entry Class
/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java
Copy the code
/** * Spring-boot-plus project boot entry *@author geekidea
* @sinceThe 2018-11-08 * /
@EnableAsync
@EnableScheduling
@EnableTransactionManagement
@EnableConfigurationProperties
@EnableAdminServer
@MapperScan({"io.geekidea.springbootplus.**.mapper"})
@SpringBootApplication
public class SpringBootPlusApplication {
public static void main(String[] args) {
/ / start spring - the boot - plus
ConfigurableApplicationContext context = SpringApplication.run(SpringBootPlusApplication.class, args);
// Prints project informationPrintApplicationInfo.print(context); }}Copy the code
4. Access the project Swagger document
http://127.0.0.1:8888/swagger-ui.html
5. System users add, delete, or change the Swagger of paging
Quick start
Quick start
Detailed documentation
springboot.plus
CentOS Quick installation environment/build/deploy/start spring-boot-Plus project
1. Download the installation script
Install JDK, Git, Maven, Redis, mysql
wget -O download-install-all.sh https://springboot.plus/bin/download-install-all.sh
Copy the code
2. Run the installation script
sh download-install-all.sh
Copy the code
3. Change the MySQL password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Springbootplus666! ';
exit
mysql -uroot -pSpringbootplus666!
Copy the code
4. Import the MySQL script
create database if not exists spring_boot_plus character set utf8mb4;
use spring_boot_plus;
source /root/mysql_spring_boot_plus.sql;
show tables;
exit
Copy the code
5. Download the deployment scriptdeploy.sh
wget -O deploy.sh https://springboot.plus/bin/deploy.sh
Copy the code
6. Execute the script
sh deploy.sh
Copy the code
7. Visit projects
SpringBootAdmin manages the page
http://47.105.159.10:8888
Spring-boot-plus Swagger documentation page
http://47.105.159.10:8888/docs
8. View project run logs
tail -f -n 1000 /root/spring-boot-plus-server/logs/spring-boot-plus.log
Copy the code
spring-boot-plus Views
spring-boot-plus IDEA Sources Views
Spring Boot Admin Instances
Spring Boot Admin Statistics
Spring Boot Admin Log
Spring – the boot – plus Swagger document
spring-boot-plus Java Api Docs
Spring – the boot – plus video: movie_camera:
- Add, delete, change and check in 5 minutes
- CentOS quick install JDK/Git/Maven/Redis/MySQL
- CentOS rapid deployment/build/package/run projects
License
Spring-boot-plus is under the Apache 2.0 license. See the license file for details.