【SpringBoot】仿 spring-boot-project 自定义 starters

本文涉及的产品
云数据库 Tair(兼容Redis),内存型 2GB
Redis 开源版,标准版 2GB
推荐场景:
搭建游戏排行榜
简介: 【SpringBoot】仿 spring-boot-project 自定义 starters

1. spring-boot-project 项目分析

  • spring-boot-project 为 spring-boot 核心技术包,其中包含了 spring-boot 所有基础源码。
  • spring-boot-test 为 springboot 的测试包,包含了系统集成测试、部署测试、冒烟测试。

本文以 spring-boot-project 工程包为模板,定制一个属于自己基础工程依赖包。下面着重介绍一下 spring-boot-project 各个模块。

spring-boot:springboot 的框架基础,其中包含了 springboot 应用启动,初始化,启动 banner,springApplication定义、构建器API、应用程序事件和侦听器、应用程序启动跟踪、管理功能。

spring-boot-dependencies:空文件包,此包是对 spring-boot 进行了依赖管理。在构建大型微服务框架时常常会引入此包,统一对依赖包进行版本管理。

spring-boot-parent:此包的父类为 spring-boot-dependencies,提供了 springBoot 快速开发,和 spring-boot-dependencies 区别在于此包适合较少自定义的应用,当自己公司有自己定义的基础框架时,springboot 官网建议使用 spring-boot-dependencies 去构架,这样有利于 maven 依赖版本的管理。

spring-boot-starters:这个模块有很多 starter 子模块,平时用的也是非常多的,Starters 可以作为一组依赖配置信息放在你项目的依赖配置中。从中您可以获得所需的所有 Spring 及其相关技术的一站式服务而无需搜索项目的配置方法并复制粘贴项目所需的依赖配置信息。如果你想使用 Spring JPA 作为数据库访问中间层,仅仅需要将 spring-boot-starter-data-jpa 加入你的项目依赖中, 即可使用 Spring JPA。

其他模块如有需要大家可以去 Github 获取相关文档或源码。

2. 自定义 starters

2.1 工程结构介绍

  1. pointer-boot-build - 即父工程,只有一个 pom 文件,主要记录一些项目信息及版本控住,这里利用 revision 占位符来统一控制版本。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.pointer.boot</groupId>
    <artifactId>pointer-boot-build</artifactId>
    <version>${revision}</version>
    <packaging>pom</packaging>
    <url>https://gitee.com/pointer_gy/pointer-boot-build</url>
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <properties>
        <revision>1.0.0-SNAPSHOT</revision>
        <main.basedir>${basedir}</main.basedir>
        <flatten-maven-plugin.version>1.2.7</flatten-maven-plugin.version>
    </properties>
    <modules>
        <module>pointer-boot</module>
        <module>pointer-boot-dependencies</module>
        <module>pointer-boot-parent</module>
        <module>pointer-boot-starters</module>
    </modules>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>flatten-maven-plugin</artifactId>
                    <version>${flatten-maven-plugin.version}</version>
                    <configuration>
                        <updatePomFile>true</updatePomFile>
                        <flattenMode>resolveCiFriendliesOnly</flattenMode>
                    </configuration>
                    <executions>
                        <execution>
                            <id>flatten</id>
                            <phase>process-resources</phase>
                            <goals>
                                <goal>flatten</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>flatten-clean</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
  1. pointer-boot - 自定义的框架基础,这里封装了统一响应结果、基础异常、基础错误码枚举、校验工具类等共用类,同时也引入了一些共用依赖,原则上每个新建的工程都需要引用此 module。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.pointer.boot</groupId>
        <artifactId>pointer-boot-parent</artifactId>
        <version>${revision}</version>
        <relativePath>../pointer-boot-parent</relativePath>
    </parent>
    <artifactId>pointer-boot</artifactId>
    <packaging>jar</packaging>
    <properties>
        <main.basedir>${basedir}/..</main.basedir>
    </properties>
    <dependencies>
        <!-- Apache Commons -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
        </dependency>
        <!-- Guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
        </dependency>
        <!-- FastJson -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <!-- Hutool -->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
        </dependency>
        <!-- MapStruct -->
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
        </dependency>
        <!-- JSR 303 Validation -->
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
        </dependency>
        <!-- Lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
        </dependency>
        <!-- Logback -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
    </dependencies>
</project>
  1. pointer-boot-dependencies - 空文件包,此包是对 pointer-boot-build 进行了依赖管理。在构建大型微服务框架时常常会引入此包,统一对依赖包进行版本管理。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.pointer.boot</groupId>
        <artifactId>pointer-boot-build</artifactId>
        <version>${revision}</version>
    </parent>
    <artifactId>pointer-boot-dependencies</artifactId>
    <packaging>pom</packaging>
    <properties>
        <main.basedir>${basedir}/..</main.basedir>
        <spring-boot.version>2.6.12</spring-boot.version>
        <!-- Spring Cloud -->
        <spring-cloud.version>2021.0.4</spring-cloud.version>
        <spring-security-version>5.6.7</spring-security-version>
        <spring-cloud-alibaba.version>2021.0.4.0</spring-cloud-alibaba.version>
        <cola.components.version>4.3.1</cola.components.version>
        <!-- Apache Dubbo -->
        <dubbo.version>3.0.10</dubbo.version>
        <!-- Apache RocketMQ -->
        <rocketmq.version>2.2.2</rocketmq.version>
        <!-- Apache ElasticJob -->
        <elasticjob.version>3.0.1</elasticjob.version>
        <!-- Sentry -->
        <sentry.version>6.3.0</sentry.version>
        <!-- SkyWalking -->
        <skywalking.version>8.8.0</skywalking.version>
        <!-- Redisson -->
        <redisson.version>3.16.8</redisson.version>
        <!-- MyBatis Plus -->
        <mybatis-plus.version>3.5.2</mybatis-plus.version>
        <mybatis-plus-dynamic-datasource.version>3.5.2</mybatis-plus-dynamic-datasource.version>
        <druid-version>1.2.13</druid-version>
        <!-- ShardingSphere-JDBC -->
        <shardingsphere-jdbc.version>5.1.2</shardingsphere-jdbc.version>
        <!-- Apache Commons -->
        <commons-collections4.version>4.4</commons-collections4.version>
        <commons-beanutils.version>1.9.4</commons-beanutils.version>
        <commons-math3.version>3.6.1</commons-math3.version>
        <commons-text.version>1.9</commons-text.version>
        <commons-io.version>2.11.0</commons-io.version>
        <commons-fileupload.version>1.4</commons-fileupload.version>
        <!-- Guava -->
        <guava.version>31.1-jre</guava.version>
        <!-- FastJson -->
        <fastjson.version>1.2.83</fastjson.version>
        <!-- Hutool -->
        <hutool.version>5.8.5</hutool.version>
        <!-- MapStruct -->
        <mapstruct.version>1.5.2.Final</mapstruct.version>
        <!-- Easy Excel -->
        <easyexcel.version>3.1.1</easyexcel.version>
        <!-- Easy Poi -->
        <easypoi.version>4.4.0</easypoi.version>
        <!-- Lombok -->
        <lombok.version>1.18.24</lombok.version>
        <!-- jwt -->
        <jwt.version>0.9.1</jwt.version>
        <!-- Maven Plugin Versions -->
        <maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
        <sonar-maven-plugin.version>3.7.0.1746</sonar-maven-plugin.version>
        <jacoco-maven-plugin.version>0.8.5</jacoco-maven-plugin.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.pointer.boot</groupId>
                <artifactId>pointer-boot</artifactId>
                <version>${revision}</version>
            </dependency>
            <dependency>
                <groupId>com.pointer.boot</groupId>
                <artifactId>pointer-boot-starter-web</artifactId>
                <version>${revision}</version>
            </dependency>
            <!-- Spring Boot -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- Spring Cloud -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- Spring Cloud Alibaba -->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                <version>${spring-cloud-alibaba.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.alibaba.cola</groupId>
                <artifactId>cola-components-bom</artifactId>
                <version>${cola.components.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.security</groupId>
                <artifactId>spring-security-bom</artifactId>
                <version>${spring-security-version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- Apache Dubbo -->
            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-dependencies-bom</artifactId>
                <version>${dubbo.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-dependencies-zookeeper</artifactId>
                <version>${dubbo.version}</version>
                <type>pom</type>
                <exclusions>
                    <exclusion>
                        <artifactId>log4j</artifactId>
                        <groupId>log4j</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>slf4j-log4j12</artifactId>
                        <groupId>org.slf4j</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.dubbo</groupId>
                <artifactId>dubbo-spring-boot-starter</artifactId>
                <version>${dubbo.version}</version>
            </dependency>
            <!-- RocketMQ -->
            <dependency>
                <groupId>org.apache.rocketmq</groupId>
                <artifactId>rocketmq-spring-boot-starter</artifactId>
                <version>${rocketmq.version}</version>
            </dependency>
            <!-- ElasticJob -->
            <dependency>
                <groupId>org.apache.shardingsphere.elasticjob</groupId>
                <artifactId>elasticjob-lite-spring-boot-starter</artifactId>
                <version>${elasticjob.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.shardingsphere.elasticjob</groupId>
                <artifactId>elasticjob-error-handler-dingtalk</artifactId>
                <version>${elasticjob.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.shardingsphere.elasticjob</groupId>
                <artifactId>elasticjob-error-handler-wechat</artifactId>
                <version>${elasticjob.version}</version>
            </dependency>
            <!-- MyBatis Plus -->
            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-boot-starter</artifactId>
                <version>${mybatis-plus.version}</version>
            </dependency>
            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
                <version>${mybatis-plus-dynamic-datasource.version}</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid-spring-boot-starter</artifactId>
                <version>${druid-version}</version>
            </dependency>
            <!-- ShardingSphere-JDBC -->
            <dependency>
                <groupId>org.apache.shardingsphere</groupId>
                <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
                <version>${shardingsphere-jdbc.version}</version>
                <exclusions>
                    <exclusion>
                        <artifactId>log4j</artifactId>
                        <groupId>log4j</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.shardingsphere</groupId>
                <artifactId>shardingsphere-cluster-mode-repository-zookeeper-curator</artifactId>
                <version>${shardingsphere-jdbc.version}</version>
            </dependency>
            <!-- Redisson -->
            <dependency>
                <groupId>org.redisson</groupId>
                <artifactId>redisson-spring-boot-starter</artifactId>
                <version>${redisson.version}</version>
            </dependency>
            <!-- SkyWalking -->
            <dependency>
                <groupId>org.apache.skywalking</groupId>
                <artifactId>apm-toolkit-logback-1.x</artifactId>
                <version>${skywalking.version}</version>
            </dependency>
            <!-- Sentry -->
            <dependency>
                <groupId>io.sentry</groupId>
                <artifactId>sentry-bom</artifactId>
                <version>${sentry.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- Apache Commons -->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>${commons-collections4.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils</artifactId>
                <version>${commons-beanutils.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-math3</artifactId>
                <version>${commons-math3.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-text</artifactId>
                <version>${commons-text.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>${commons-fileupload.version}</version>
            </dependency>
            <!-- Guava -->
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <!-- FastJson -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>${fastjson.version}</version>
            </dependency>
            <!-- Hutool -->
            <dependency>
                <groupId>cn.hutool</groupId>
                <artifactId>hutool-all</artifactId>
                <version>${hutool.version}</version>
            </dependency>
            <!-- MapStruct -->
            <dependency>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct</artifactId>
                <version>${mapstruct.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct-processor</artifactId>
                <version>${mapstruct.version}</version>
            </dependency>
            <!-- Easy Excel -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>easyexcel</artifactId>
                <version>${easyexcel.version}</version>
            </dependency>
            <!-- Easy Poi -->
            <dependency>
                <groupId>cn.afterturn</groupId>
                <artifactId>easypoi-spring-boot-starter</artifactId>
                <version>${easypoi.version}</version>
            </dependency>
            <!-- Lombok -->
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
            <!-- Jwt -->
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt</artifactId>
                <version>${jwt.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${spring-boot.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>${sonar-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>
  1. pointer-boot-parent - 此包的父类为 pointer-boot-dependencies,提供了 pointer-boot 快速开发,和 pointer-boot-dependencies 区别在于此包适合较少自定义的应用,这里是我自己定义的基础框架,使用 spring-boot-dependencies 去构架,这样有利于 maven 依赖版本的管理。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.pointer.boot</groupId>
        <artifactId>pointer-boot-dependencies</artifactId>
        <version>${revision}</version>
        <relativePath>../pointer-boot-dependencies</relativePath>
    </parent>
    <artifactId>pointer-boot-parent</artifactId>
    <packaging>pom</packaging>
    <properties>
        <main.basedir>${basedir}/..</main.basedir>
        <java.version>1.8</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
</project>
  1. pointer-boot-starters - 这个模块有很多 starter 子模块,平时用的也是非常多的,Starters 可以作为一组依赖配置信息放在你项目的依赖配置中。这里我只定义了 pointer-boot-starter-web,其封装了一些 web 相关,如: 全局异常捕获处理、全局格式化配置、全局响应拦截器等等。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.pointer.boot</groupId>
        <artifactId>pointer-boot-parent</artifactId>
        <version>${revision}</version>
        <relativePath>../pointer-boot-parent</relativePath>
    </parent>
    <artifactId>pointer-boot-starters</artifactId>
    <packaging>pom</packaging>
    <properties>
        <main.basedir>${basedir}/..</main.basedir>
    </properties>
    <modules>
        <module>pointer-boot-starter-web</module>
    </modules>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.pointer.boot</groupId>
        <artifactId>pointer-boot-starters</artifactId>
        <version>${revision}</version>
    </parent>
    <artifactId>pointer-boot-starter-web</artifactId>
    <packaging>jar</packaging>
    <properties>
        <main.basedir>${basedir}/../..</main.basedir>
    </properties>
    <dependencies>
        <!-- Pointer Boot -->
        <dependency>
            <groupId>com.pointer.boot</groupId>
            <artifactId>pointer-boot</artifactId>
        </dependency>
        <!-- Spring Boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
    </dependencies>
</project>

具体实现就不展开讲了,直接上代码:https://gitee.com/pointer_gy/pointer-boot-build.git

相关实践学习
基于Redis实现在线游戏积分排行榜
本场景将介绍如何基于Redis数据库实现在线游戏中的游戏玩家积分排行榜功能。
云数据库 Redis 版使用教程
云数据库Redis版是兼容Redis协议标准的、提供持久化的内存数据库服务,基于高可靠双机热备架构及可无缝扩展的集群架构,满足高读写性能场景及容量需弹性变配的业务需求。 产品详情:https://www.aliyun.com/product/kvstore &nbsp; &nbsp; ------------------------------------------------------------------------- 阿里云数据库体验:数据库上云实战 开发者云会免费提供一台带自建MySQL的源数据库&nbsp;ECS 实例和一台目标数据库&nbsp;RDS实例。跟着指引,您可以一步步实现将ECS自建数据库迁移到目标数据库RDS。 点击下方链接,领取免费ECS&amp;RDS资源,30分钟完成数据库上云实战!https://developer.aliyun.com/adc/scenario/51eefbd1894e42f6bb9acacadd3f9121?spm=a2c6h.13788135.J_3257954370.9.4ba85f24utseFl
相关文章
|
1月前
|
NoSQL Java Redis
redis的基本命令,并用netty操作redis(不使用springboot或者spring框架)就单纯的用netty搞。
这篇文章介绍了Redis的基本命令,并展示了如何使用Netty框架直接与Redis服务器进行通信,包括设置Netty客户端、编写处理程序以及初始化Channel的完整示例代码。
44 1
redis的基本命令,并用netty操作redis(不使用springboot或者spring框架)就单纯的用netty搞。
|
1月前
|
监控 Java 应用服务中间件
Spring和Spring Boot的区别
Spring和Spring Boot的主要区别,包括项目配置、开发模式、项目依赖、内嵌服务器和监控管理等方面,强调Spring Boot基于Spring框架,通过约定优于配置、自动配置和快速启动器等特性,简化了Spring应用的开发和部署过程。
52 19
|
1月前
|
Java 测试技术 开发者
springboot学习四:Spring Boot profile多环境配置、devtools热部署
这篇文章主要介绍了如何在Spring Boot中进行多环境配置以及如何整合DevTools实现热部署,以提高开发效率。
58 2
|
1月前
|
前端开发 Java 程序员
springboot 学习十五:Spring Boot 优雅的集成Swagger2、Knife4j
这篇文章是关于如何在Spring Boot项目中集成Swagger2和Knife4j来生成和美化API接口文档的详细教程。
90 1
|
1月前
|
Java API Spring
springboot学习七:Spring Boot2.x 拦截器基础入门&实战项目场景实现
这篇文章是关于Spring Boot 2.x中拦截器的入门教程和实战项目场景实现的详细指南。
26 0
springboot学习七:Spring Boot2.x 拦截器基础入门&实战项目场景实现
|
1月前
|
Java API Spring
springboot学习六:Spring Boot2.x 过滤器基础入门&实战项目场景实现
这篇文章是关于Spring Boot 2.x中过滤器的基础知识和实战项目应用的教程。
24 0
springboot学习六:Spring Boot2.x 过滤器基础入门&实战项目场景实现
|
1月前
|
Java 测试技术 Spring
springboot学习三:Spring Boot 配置文件语法、静态工具类读取配置文件、静态工具类读取配置文件
这篇文章介绍了Spring Boot中配置文件的语法、如何读取配置文件以及如何通过静态工具类读取配置文件。
47 0
springboot学习三:Spring Boot 配置文件语法、静态工具类读取配置文件、静态工具类读取配置文件
|
1月前
|
SQL Java 数据库
Springboot+spring-boot-starter-data-jdbc实现数据库的操作
本文介绍了如何使用Spring Boot的spring-boot-starter-data-jdbc依赖来操作数据库,包括添加依赖、配置数据库信息和编写基于JdbcTemplate的数据访问代码。
53 2
|
1月前
|
XML Java 应用服务中间件
【Spring】运行Spring Boot项目,请求响应流程分析以及404和500报错
【Spring】运行Spring Boot项目,请求响应流程分析以及404和500报错
168 2
|
1月前
|
前端开发 安全 Java
【Spring】Spring Boot项目创建和目录介绍
【Spring】Spring Boot项目创建和目录介绍
84 2