欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SpringCloud高可用配置中心Config詳解

 更新時(shí)間:2022年04月27日 09:51:36   作者:m0_67401606  
Spring Cloud Config 是一個(gè)解決分布式系統(tǒng)的配置管理方案,它包含了 server 和 client 兩個(gè)部分,這篇文章主要介紹了SpringCloud之配置中心Config(高可用),需要的朋友可以參考下

前言

SpringCloud 是微服務(wù)中的翹楚,最佳的落地方案。

Spring Cloud Config 是一個(gè)解決分布式系統(tǒng)的配置管理方案,它包含了 server 和 client 兩個(gè)部分。

server 用來(lái)獲取遠(yuǎn)程的配置信息(默認(rèn)為 Git 倉(cāng)庫(kù)),并且以接口的形式提供出去;

client 根據(jù) server 提供的接口讀取配置文件,以便于初始化自己的應(yīng)用。

如果配置中心出現(xiàn)了問(wèn)題,將導(dǎo)致災(zāi)難性的后果,因此在生產(chǎn)環(huán)境下配置中心都會(huì)做集群,來(lái)保證高可用。

此處配置高可用實(shí)際就是把多個(gè)配置中心(指定同一個(gè) Git 遠(yuǎn)程倉(cāng)庫(kù))注冊(cè)到注冊(cè)中心。

源碼

GitHub地址:https://github.com/intomylife/SpringCloud

環(huán)境

  • JDK 1.8.0 +
  • Maven 3.0 +
  • SpringBoot 2.0.3
  • SpringCloud Finchley.RELEASE

開(kāi)發(fā)工具

IntelliJ IDEA

正文

commons 工程

commons 工程 - POM 文件

<?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>
    <!-- 三坐標(biāo) -->
    <groupId>com.zwc</groupId>
    <artifactId>springcloud-config-eureka-commons</artifactId>
    <version>1.0</version>
    <!-- 工程名稱和描述 -->
    <name>springcloud-config-eureka-commons</name>
    <description>公用工程</description>
    <!-- 打包方式 -->
    <packaging>jar</packaging>
    <!-- 在 properties下聲明相應(yīng)的版本信息,然后在dependency下引用的時(shí)候用 ${} 就可以引入該版本jar包了 -->
    <properties>
        <!-- 編碼 -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <!-- jdk -->
        <java.version>1.8</java.version>
        <!-- SpringBoot -->
        <platform-bom.version>Cairo-SR3</platform-bom.version>
        <!-- SpringCloud -->
        <spring-cloud-dependencies.version>Finchley.RELEASE</spring-cloud-dependencies.version>
    </properties>
    <!-- 加入依賴 -->
    <dependencies>
    </dependencies>
    <!-- 依賴 jar 包版本管理的管理器 -->
    <!-- 如果 dependencies 里的 dependency 自己沒(méi)有聲明 version 元素,那么 maven 就此處來(lái)找版本聲明。 -->
    <!-- 如果有,就會(huì)繼承它;如果沒(méi)有就會(huì)報(bào)錯(cuò),告訴你沒(méi)有版本信息 -->
    <!-- 優(yōu)先級(jí):如果 dependencies 里的 dependency 已經(jīng)聲明了版本信息,就不會(huì)生效此處的版本信息了 -->
    <dependencyManagement>
        <dependencies>
            <!-- SpringBoot -->
            <dependency>
                <groupId>io.spring.platform</groupId>
                <artifactId>platform-bom</artifactId>
                <version>${platform-bom.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!-- SpringCloud -->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud-dependencies.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <!-- 插件依賴 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

配置一些共用依賴

commons 工程 - 項(xiàng)目結(jié)構(gòu)

配置文件

創(chuàng)建一個(gè) Git 庫(kù),里面存放配置文件,文件夾名稱為:config-repo;這里模擬不同的環(huán)境,所以分別構(gòu)建了

dev(開(kāi)發(fā))、uat(測(cè)試)以及online(線上)三種不同的配置文件;此文件夾存在此項(xiàng)目的根目錄中

- springcloud-config-eureka
? - config-repo
? ? -?system-dev.properties
? ? -?system-online.properties
? ? -?system-uat.properties
  + springcloud-config-eureka-commons
  + springcloud-config-eureka-service

service 工程

① 此工程下有四個(gè)模塊:一個(gè)注冊(cè)中心,二個(gè) server 以及一個(gè) client

② 二個(gè) server 除端口不一致以外,其他代碼基本一致

registry-service(注冊(cè)中心)

registry-service - POM 文件

<?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.zwc</groupId>
        <artifactId>springcloud-config-eureka-service</artifactId>
        <version>1.0</version>
    </parent>
    <!-- 三坐標(biāo) -->
    <groupId>com.zwc</groupId>
    <artifactId>springcloud-config-eureka-registry-service</artifactId>
    <version>1.0</version>
    <!-- 工程名稱描述 -->
    <name>springcloud-config-eureka-registry-service</name>
    <description>注冊(cè)中心</description>
    <!-- 打包方式 -->
    <packaging>jar</packaging>
    <!-- 在 properties下聲明相應(yīng)的版本信息,然后在dependency下引用的時(shí)候用 ${} 就可以引入該版本jar包了 -->
    <properties>
    </properties>
    <!-- 加入依賴 -->
    <dependencies>
        <!-- commons工程 依賴 -->
        <dependency>
            <groupId>com.zwc</groupId>
            <artifactId>springcloud-config-eureka-commons</artifactId>
            <version>1.0</version>
        </dependency>
        <!-- 服務(wù)注冊(cè)中心 -->
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    </dependencies>
    <!-- 插件依賴 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

主要加入spring-cloud-starter-netflix-eureka-server依賴

registry-service - application.yml配置文件

# 端口
server:
  port: 8761
# 應(yīng)用名稱
spring:
  application:
    name: eureka-server
eureka:
  instance:
    # 使用 ip 代替實(shí)例名
    prefer-ip-address: true
    # 實(shí)例的主機(jī)名
    hostname: ${spring.cloud.client.ip-address}
    # 實(shí)例的 ID 規(guī)則
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
  client:
    # 是否向注冊(cè)中心注冊(cè)自己
    registerWithEureka: false
    # 是否向注冊(cè)中心獲取注冊(cè)信息
    fetchRegistry: false
    serviceUrl:
      # 注冊(cè)中心地址
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

這里使用了默認(rèn)的 8761 端口,當(dāng)然也可以更改,不過(guò)在發(fā)現(xiàn)調(diào)用服務(wù)端的注冊(cè)中心地址端口要與它一致

registry-service - 啟動(dòng)類

package com.zwc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class SpringcloudConfigEurekaRegistryServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringcloudConfigEurekaRegistryServiceApplication.class, args);
    }
}

在啟動(dòng)類中添加 @EnableEurekaServer 注解表示此工程是注冊(cè)中心

registry-server - 啟動(dòng)項(xiàng)目

1. 項(xiàng)目啟動(dòng)成功后訪問(wèn)http://localhost:8761/即可看到eureka-server 主頁(yè)面

server(獲取遠(yuǎn)程的配置信息)

server- POM 文件

注:一共有兩個(gè) server,但是除端口以外的代碼基本上一致,所有這里就列舉其中一個(gè)

<?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.zwc</groupId>
        <artifactId>springcloud-config-eureka-service</artifactId>
        <version>1.0</version>
    </parent>
    <!-- 三坐標(biāo) -->
    <groupId>com.zwc</groupId>
    <artifactId>springcloud-config-eureka-serverfirst-service</artifactId>
    <version>1.0</version>
    <!-- 工程名稱描述 -->
    <name>springcloud-config-eureka-serverfirst-service</name>
    <description>config server</description>
    <!-- 打包方式 -->
    <packaging>jar</packaging>
    <!-- 在 properties下聲明相應(yīng)的版本信息,然后在dependency下引用的時(shí)候用 ${} 就可以引入該版本jar包了 -->
    <properties>
    </properties>
    <!-- 加入依賴 -->
    <dependencies>
        <!-- commons工程 依賴 -->
        <dependency>
            <groupId>com.zwc</groupId>
            <artifactId>springcloud-config-eureka-commons</artifactId>
            <version>1.0</version>
        </dependency>
        <!-- config server 依賴 -->
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        <!-- 提供者消費(fèi)者 -->
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependencies>
    <!-- 插件依賴 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
  • 加入spring-cloud-config-server依賴:config server
  • 加入spring-cloud-starter-netflix-eureka-client依賴:提供和注冊(cè)服務(wù)

server- application.yml配置文件

# 端口
server:
  port: 8000

spring:
  application:
    # 應(yīng)用名稱
    name: config-eureka-server
  cloud:
    config:
      server:
        git:
          # 倉(cāng)庫(kù)地址
          uri: https://github.com/intomylife/SpringCloud
          # 對(duì)應(yīng) {label} 部分,即 Git 的分支
          label: master
          # 倉(cāng)庫(kù)文件夾名稱,多個(gè)以逗號(hào)分隔
          search-paths: springcloud-config-eureka/config-repo
          # git 倉(cāng)庫(kù)用戶名(公開(kāi)庫(kù)可以不用填寫)
          username:
          # git 倉(cāng)庫(kù)密碼(公開(kāi)庫(kù)可以不用填寫)
          password:
eureka:
  instance:
    # 使用 ip 代替實(shí)例名
    prefer-ip-address: true
    # 實(shí)例的主機(jī)名
    hostname: ${spring.cloud.client.ip-address}
    # 實(shí)例的 ID 規(guī)則
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
  client:
    serviceUrl:
      # 注冊(cè)中心地址
      defaultZone: http://${eureka.instance.hostname}:8761/eureka/
  • 注意這里 uri 只能寫到倉(cāng)庫(kù)名
  • 如果配置文件在倉(cāng)庫(kù)中多層目錄下,那么search-paths 就從根目錄開(kāi)始寫起
  • 注意此處配置注冊(cè)中心地址的端口為 8761 也就是上面注冊(cè)中心工程配置的端口
package com.zwc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableConfigServer
@EnableEurekaClient
public class SpringcloudConfigEurekaServerfirstServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringcloudConfigEurekaServerfirstServiceApplication.class, args);
    }
}
  • 添加@EnableConfigServer 注解表示開(kāi)啟配置中心
  • 添加 @EnableEurekaClient 注解表示此工程可以向注冊(cè)中心提供服務(wù)

server- 啟動(dòng)項(xiàng)目

1.項(xiàng)目啟動(dòng)成功后訪問(wèn):http://localhost:8761/(注冊(cè)中心)可以看到服務(wù)已經(jīng)被注冊(cè)進(jìn)來(lái)了

2. 訪問(wèn)地址:http://localhost:8000/config-repo/dev(獲取完整配置信息)

3.輸出內(nèi)容:

{
    "name":"config-repo",
    "profiles":[
        "dev"
    ],
    "label":null,
    "version":"0d6480b5ba6f7f2be87b3130de8163dcb0af9f5f",
    "state":null,
    "propertySources":[

    ]
}

4. 訪問(wèn)地址:http://localhost:8000/system/dev(獲取完整配置信息)

5. 輸出內(nèi)容:

{
    "name":"system",
    "profiles":[
        "dev"
    ],
    "label":null,
    "version":"0d6480b5ba6f7f2be87b3130de8163dcb0af9f5f",
    "state":null,
    "propertySources":[
        {
            "name":"https://github.com/intomylife/SpringCloud/springcloud-config-eureka/config-repo/system-dev.properties",
            "source":{
                "hello":"I'm dev."
            }
        }
    ]
}

6. 訪問(wèn)地址:http://localhost:8000/system-dev.properties(獲取指定配置文件內(nèi)容)

7. 輸出內(nèi)容:‘hello: I’m dev.’

8. 啟動(dòng)另一個(gè) server(springcloud-config-eureka-serversecond-service)

9.項(xiàng)目啟動(dòng)成功后訪問(wèn):http://localhost:8761/(注冊(cè)中心)可以看到服務(wù)已經(jīng)被注冊(cè)進(jìn)來(lái)了

10.訪問(wèn)地址:http://localhost:8001/config-repo/uat(獲取完整配置信息)

11. 輸出內(nèi)容:

{
    "name":"config-repo",
    "profiles":[
        "uat"
    ],
    "label":null,
    "version":"0d6480b5ba6f7f2be87b3130de8163dcb0af9f5f",
    "state":null,
    "propertySources":[

    ]
}

12.訪問(wèn)地址:http://localhost:8001/system/uat(獲取完整配置信息)

13.輸出內(nèi)容:

{
    "name":"system",
    "profiles":[
        "uat"
    ],
    "label":null,
    "version":"0d6480b5ba6f7f2be87b3130de8163dcb0af9f5f",
    "state":null,
    "propertySources":[
        {
            "name":"https://github.com/intomylife/SpringCloud/springcloud-config-eureka/config-repo/system-uat.properties",
            "source":{
                "hello":"I'm uat."
            }
        }
    ]
}

14.訪問(wèn)地址:http://localhost:8001/system-uat.properties(獲取指定配置文件內(nèi)容)

15. 輸出內(nèi)容:‘hello: I’m uat.’

16. 證明兩個(gè) server 都已經(jīng)成功從遠(yuǎn)程倉(cāng)庫(kù)中獲取到了配置信息

注:接口訪問(wèn)有如下規(guī)則:

/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{label}/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.properties

client(讀取注冊(cè)中心的server 中的配置信息)

client- POM 文件

<?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.zwc</groupId>
        <artifactId>springcloud-config-eureka-service</artifactId>
        <version>1.0</version>
    </parent>
    <!-- 三坐標(biāo) -->
    <groupId>com.zwc</groupId>
    <artifactId>springcloud-config-eureka-client-service</artifactId>
    <version>1.0</version>
    <!-- 工程名稱描述 -->
    <name>springcloud-config-eureka-client-service</name>
    <description>config client</description>
    <!-- 打包方式 -->
    <packaging>jar</packaging>
    <!-- 在 properties下聲明相應(yīng)的版本信息,然后在dependency下引用的時(shí)候用 ${} 就可以引入該版本jar包了 -->
    <properties>
    </properties>
    <!-- 加入依賴 -->
    <dependencies>
        <!-- commons工程 依賴 -->
        <dependency>
            <groupId>com.zwc</groupId>
            <artifactId>springcloud-config-eureka-commons</artifactId>
            <version>1.0</version>
        </dependency>
        <!-- config 依賴 -->
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        <!-- 提供者消費(fèi)者 -->
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependencies>
    <!-- 插件依賴 -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
  • 加入spring-cloud-starter-config依賴:config client
  • 加入spring-cloud-starter-netflix-eureka-client依賴:提供和注冊(cè)服務(wù)

client- application.yml配置文件

# 端口
server:
  port: 8002

spring:
  application:
    # 應(yīng)用名稱
    name: config-eureka-client

client- bootstrap.yml 配置文件(注意)

spring:
  cloud:
    config:
      # 對(duì)應(yīng) {label} 部分,即 Git 的分支
      label: master
      # 對(duì)應(yīng) {application} 部分
      name: system
      # 對(duì)應(yīng) {profile} 部分
      profile: dev
      discovery:
        # 開(kāi)啟 Config 服務(wù)發(fā)現(xiàn)與注冊(cè)
        enabled: true
        # 指定 server
        service-id: config-eureka-server
eureka:
  instance:
    # 使用 ip 代替實(shí)例名
    prefer-ip-address: true
    # 實(shí)例的主機(jī)名
    hostname: ${spring.cloud.client.ip-address}
    # 實(shí)例的 ID 規(guī)則
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
  client:
    serviceUrl:
      # 注冊(cè)中心地址
      defaultZone: http://${eureka.instance.hostname}:8761/eureka/
  • bootstrap.yml 配置文件加載先于application.yml 配置文件
  • 與 Spring Cloud Config 相關(guān)的屬性必須配置在bootstrap.yml 中
  • 這里就不是直接指定 server 地址了,而是 server 的應(yīng)用名(spring.application.name)
  • 從注冊(cè)中心的 server 中讀取 dev(開(kāi)發(fā))環(huán)境的配置文件信息
  • 注意此處配置注冊(cè)中心地址的端口為 8761 也就是上面注冊(cè)中心工程配置的端口

client- controller 前端控制器

package com.zwc.client.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @ClassName HelloController
 * @Desc TODO   讀取 git 配置文件
 * @Date 2019/6/2 16:54
 * @Version 1.0
 */
@RestController
public class HelloController {
    @Value("${hello}")
    private String hello;
    /*
     * @ClassName HelloController
     * @Desc TODO   讀取 git 配置文件
     * @Date 2019/6/2 16:56
     * @Version 1.0
     */
    @RequestMapping("/hello")
    public String hello() {
        return this.hello;
    }
}

直接使用@Value 注解就可以從注冊(cè)中心的server 中讀取到對(duì)應(yīng)的配置信息

client- 啟動(dòng)類

package com.zwc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableEurekaClient
public class SpringcloudConfigEurekaClientServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringcloudConfigEurekaClientServiceApplication.class, args);
    }
}

添加 @EnableEurekaClient 注解表示此工程可以向注冊(cè)中心提供服務(wù)

client- 啟動(dòng)項(xiàng)目

1.項(xiàng)目啟動(dòng)成功后訪問(wèn):http://localhost:8761/(注冊(cè)中心)可以看到服務(wù)已經(jīng)被注冊(cè)進(jìn)來(lái)了

2.訪問(wèn)地址:http://localhost:8002/hello

3. 輸出內(nèi)容:‘I’m dev.’

4. 證明 client 已經(jīng)成功從注冊(cè)中心的 server 中讀取到了配置信息

5. 此時(shí)當(dāng) client 已經(jīng)啟動(dòng)完畢后,配置文件就已經(jīng)全部讀取到了,所以即使停止其中一個(gè) server 或者停止

全部 server,client 依然可以讀取到配置文件。此處高可用應(yīng)該是指在 client 啟動(dòng)時(shí)能保證有 server 可用

service 工程 -項(xiàng)目結(jié)構(gòu)

把多工程項(xiàng)目使用 IntelliJ IDEA 打開(kāi)

  • 把項(xiàng)目從 GitHub 中下載到你的本地
  • 打開(kāi)IntelliJ IDEA
  • 點(diǎn)擊 File -> Open
  • 打開(kāi)你下載到本地的項(xiàng)目目錄
  • springcloud-config-eureka ->springcloud-config-eureka-service(選擇打開(kāi)此工程)
  • 打開(kāi) service 工程后
  • 再次點(diǎn)擊 File -> Project Structrue
  • 選擇 Modules,點(diǎn)擊 ‘+’ 符號(hào)
  • 點(diǎn)擊 ImportModule
  • 還是打開(kāi)你下載到本地的項(xiàng)目目錄
  • springcloud-config-eureka ->springcloud-config-eureka-commons -> pom.xml
  • 點(diǎn)擊 OK
  • 點(diǎn)擊 Next,F(xiàn)inish
  • 點(diǎn)擊 Apply,OK

希望能夠幫助到你

到此這篇關(guān)于SpringCloud之配置中心Config(高可用)的文章就介紹到這了,更多相關(guān)SpringCloud配置中心Config內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java實(shí)現(xiàn)Dijkstra算法的示例代碼

    Java實(shí)現(xiàn)Dijkstra算法的示例代碼

    Dijkstra(迪杰斯特拉)算法是典型的單源最短路徑算法,用于計(jì)算一個(gè)節(jié)點(diǎn)到其他所有節(jié)點(diǎn)的最短路徑。本文主要介紹了實(shí)現(xiàn)這一算法的Java代碼,需要的可以參考一下
    2022-07-07
  • SpringBoot整合RestTemplate用法的實(shí)現(xiàn)

    SpringBoot整合RestTemplate用法的實(shí)現(xiàn)

    本篇主要介紹了RestTemplate中的GET,POST,PUT,DELETE、文件上傳和文件下載6大常用的功能,具有一定的參考價(jià)值,感興趣的可以了解一下
    2023-08-08
  • SpringBoot實(shí)現(xiàn)自定義線程池的方法

    SpringBoot實(shí)現(xiàn)自定義線程池的方法

    這篇文章主要介紹了SpringBoot中的自定義線程池解析,實(shí)現(xiàn)自定義線程池重寫spring默認(rèn)線程池的方式使用的時(shí)候,只需要加@Async注解就可以,不用去聲明線程池類,需要的朋友可以參考下
    2023-11-11
  • spring?boot整合mongo查詢converter異常排查記錄

    spring?boot整合mongo查詢converter異常排查記錄

    這篇文章主要為大家介紹了spring?boot整合mongo查詢時(shí)拋出converter異常的排查解決記錄,有需要的朋友可以借鑒參考下,希望能夠有所幫助
    2022-03-03
  • maven工程中讀取resources中的資源文件

    maven工程中讀取resources中的資源文件

    Web項(xiàng)目中應(yīng)該經(jīng)常有這樣的需求,在maven項(xiàng)目的resources目錄下放一些文件,比如一些配置文件,資源文件等,本文主要介紹了maven工程中讀取resources中的資源文件,具有一定的參考價(jià)值,感興趣的可以了解一下
    2023-12-12
  • SpringBoot整合阿里云開(kāi)通短信服務(wù)詳解

    SpringBoot整合阿里云開(kāi)通短信服務(wù)詳解

    這篇文章主要介紹了如何利用SpringBoot整合阿里云實(shí)現(xiàn)短信服務(wù)的開(kāi)通,文中的示例代碼講解詳細(xì),對(duì)我們學(xué)習(xí)有一定幫助,需要的可以參考一下
    2022-03-03
  • springboot?@PostConstruct無(wú)效的解決

    springboot?@PostConstruct無(wú)效的解決

    這篇文章主要介紹了springboot?@PostConstruct無(wú)效的解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-11-11
  • idea啟動(dòng)項(xiàng)目提示端口占用的問(wèn)題解決

    idea啟動(dòng)項(xiàng)目提示端口占用的問(wèn)題解決

    有時(shí)候當(dāng)我們使用Tomcat啟動(dòng)web項(xiàng)目時(shí),會(huì)提示端口占用,導(dǎo)致啟動(dòng)失敗,本文就來(lái)介紹一下端口占用的解決方法,具有一定的參考價(jià)值,感興趣的可以了解下
    2023-08-08
  • SpringMVC響應(yīng)視圖和結(jié)果視圖詳解

    SpringMVC響應(yīng)視圖和結(jié)果視圖詳解

    這篇文章主要介紹了SpringMVC響應(yīng)視圖和結(jié)果視圖,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-09-09
  • Spring整合Quartz實(shí)現(xiàn)動(dòng)態(tài)定時(shí)器的示例代碼

    Spring整合Quartz實(shí)現(xiàn)動(dòng)態(tài)定時(shí)器的示例代碼

    本篇文章主要介紹了Spring整合Quartz實(shí)現(xiàn)動(dòng)態(tài)定時(shí)器的示例代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。
    2017-01-01

最新評(píng)論