最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SpringCloud高可用配置中心Config詳解

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

前言

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

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

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

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

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

此處配置高可用實際就是把多個配置中心(指定同一個 Git 遠(yuǎn)程倉庫)注冊到注冊中心。

源碼

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

環(huán)境

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

開發(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下引用的時候用 ${} 就可以引入該版本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 自己沒有聲明 version 元素,那么 maven 就此處來找版本聲明。 -->
    <!-- 如果有,就會繼承它;如果沒有就會報錯,告訴你沒有版本信息 -->
    <!-- 優(yōu)先級:如果 dependencies 里的 dependency 已經(jīng)聲明了版本信息,就不會生效此處的版本信息了 -->
    <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 工程 - 項目結(jié)構(gòu)

配置文件

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

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

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

service 工程

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

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

registry-service(注冊中心)

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>注冊中心</description>
    <!-- 打包方式 -->
    <packaging>jar</packaging>
    <!-- 在 properties下聲明相應(yīng)的版本信息,然后在dependency下引用的時候用 ${} 就可以引入該版本jar包了 -->
    <properties>
    </properties>
    <!-- 加入依賴 -->
    <dependencies>
        <!-- commons工程 依賴 -->
        <dependency>
            <groupId>com.zwc</groupId>
            <artifactId>springcloud-config-eureka-commons</artifactId>
            <version>1.0</version>
        </dependency>
        <!-- 服務(wù)注冊中心 -->
            <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 代替實例名
    prefer-ip-address: true
    # 實例的主機(jī)名
    hostname: ${spring.cloud.client.ip-address}
    # 實例的 ID 規(guī)則
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
  client:
    # 是否向注冊中心注冊自己
    registerWithEureka: false
    # 是否向注冊中心獲取注冊信息
    fetchRegistry: false
    serviceUrl:
      # 注冊中心地址
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

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

registry-service - 啟動類

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);
    }
}

在啟動類中添加 @EnableEurekaServer 注解表示此工程是注冊中心

registry-server - 啟動項目

1. 項目啟動成功后訪問http://localhost:8761/即可看到eureka-server 主頁面

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

server- POM 文件

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

<?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下引用的時候用 ${} 就可以引入該版本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>
        <!-- 提供者消費者 -->
            <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依賴:提供和注冊服務(wù)

server- application.yml配置文件

# 端口
server:
  port: 8000

spring:
  application:
    # 應(yīng)用名稱
    name: config-eureka-server
  cloud:
    config:
      server:
        git:
          # 倉庫地址
          uri: https://github.com/intomylife/SpringCloud
          # 對應(yīng) {label} 部分,即 Git 的分支
          label: master
          # 倉庫文件夾名稱,多個以逗號分隔
          search-paths: springcloud-config-eureka/config-repo
          # git 倉庫用戶名(公開庫可以不用填寫)
          username:
          # git 倉庫密碼(公開庫可以不用填寫)
          password:
eureka:
  instance:
    # 使用 ip 代替實例名
    prefer-ip-address: true
    # 實例的主機(jī)名
    hostname: ${spring.cloud.client.ip-address}
    # 實例的 ID 規(guī)則
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
  client:
    serviceUrl:
      # 注冊中心地址
      defaultZone: http://${eureka.instance.hostname}:8761/eureka/
  • 注意這里 uri 只能寫到倉庫名
  • 如果配置文件在倉庫中多層目錄下,那么search-paths 就從根目錄開始寫起
  • 注意此處配置注冊中心地址的端口為 8761 也就是上面注冊中心工程配置的端口
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 注解表示開啟配置中心
  • 添加 @EnableEurekaClient 注解表示此工程可以向注冊中心提供服務(wù)

server- 啟動項目

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

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

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

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

    ]
}

4. 訪問地址: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. 訪問地址:http://localhost:8000/system-dev.properties(獲取指定配置文件內(nèi)容)

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

8. 啟動另一個 server(springcloud-config-eureka-serversecond-service)

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

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

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

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

    ]
}

12.訪問地址: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.訪問地址:http://localhost:8001/system-uat.properties(獲取指定配置文件內(nèi)容)

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

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

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

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

client(讀取注冊中心的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下引用的時候用 ${} 就可以引入該版本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>
        <!-- 提供者消費者 -->
            <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依賴:提供和注冊服務(wù)

client- application.yml配置文件

# 端口
server:
  port: 8002

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

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

spring:
  cloud:
    config:
      # 對應(yīng) {label} 部分,即 Git 的分支
      label: master
      # 對應(yīng) {application} 部分
      name: system
      # 對應(yīng) {profile} 部分
      profile: dev
      discovery:
        # 開啟 Config 服務(wù)發(fā)現(xiàn)與注冊
        enabled: true
        # 指定 server
        service-id: config-eureka-server
eureka:
  instance:
    # 使用 ip 代替實例名
    prefer-ip-address: true
    # 實例的主機(jī)名
    hostname: ${spring.cloud.client.ip-address}
    # 實例的 ID 規(guī)則
    instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
  client:
    serviceUrl:
      # 注冊中心地址
      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)
  • 從注冊中心的 server 中讀取 dev(開發(fā))環(huán)境的配置文件信息
  • 注意此處配置注冊中心地址的端口為 8761 也就是上面注冊中心工程配置的端口

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 注解就可以從注冊中心的server 中讀取到對應(yīng)的配置信息

client- 啟動類

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 注解表示此工程可以向注冊中心提供服務(wù)

client- 啟動項目

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

2.訪問地址:http://localhost:8002/hello

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

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

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

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

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

把多工程項目使用 IntelliJ IDEA 打開

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

希望能夠幫助到你

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

相關(guān)文章

  • 你真的懂java的日志系統(tǒng)嗎

    你真的懂java的日志系統(tǒng)嗎

    日志管理的第一件事,就是日志的收集,日志收集是開發(fā)者必備的技巧,不管是哪個開發(fā)語言,哪個開發(fā)平臺,日志收集的插件都是有很多選擇的,下面這篇文章主要給大家介紹了關(guān)于java日志系統(tǒng)的相關(guān)資料,需要的朋友可以參考下
    2022-02-02
  • Java實現(xiàn)將word轉(zhuǎn)換為html的方法示例【doc與docx格式】

    Java實現(xiàn)將word轉(zhuǎn)換為html的方法示例【doc與docx格式】

    這篇文章主要介紹了Java實現(xiàn)將word轉(zhuǎn)換為html的方法,結(jié)合實例形式分析了java針對doc與docx格式文件的相關(guān)轉(zhuǎn)換操作技巧,需要的朋友可以參考下
    2019-03-03
  • java為何不能多繼承的原因詳解

    java為何不能多繼承的原因詳解

    多重繼承是一個子類從多個父類中繼承屬性和方法。C++, Common Lisp是時下支持多重繼承的流行語言。那java為何不能多繼承呢,下面小編帶大家來一起學(xué)習(xí)一下吧
    2019-06-06
  • 詳解hibernate4基本實現(xiàn)原理

    詳解hibernate4基本實現(xiàn)原理

    本文通過圖文并茂的形式給大家介紹的hibernate4基本實現(xiàn)原理,非常不錯,具有參考借鑒價值,需要的朋友參考下吧
    2017-09-09
  • Java使用Condition控制線程通信的方法實例詳解

    Java使用Condition控制線程通信的方法實例詳解

    這篇文章主要介紹了Java使用Condition控制線程通信的方法,結(jié)合實例形式分析了使用Condition類同步檢測控制線程通信的相關(guān)操作技巧,需要的朋友可以參考下
    2019-09-09
  • 使用BigDecimal進(jìn)行精確運(yùn)算(實現(xiàn)加減乘除運(yùn)算)

    使用BigDecimal進(jìn)行精確運(yùn)算(實現(xiàn)加減乘除運(yùn)算)

    這篇文章主要介紹了如何使用BigDecimal進(jìn)行精確運(yùn)算,最后提供了一個工具類,該工具類提供加,減,乘,除運(yùn)算
    2013-11-11
  • 在SpringBoot中定義和讀取自定義配置的方法步驟

    在SpringBoot中定義和讀取自定義配置的方法步驟

    在Spring Boot中定義和讀取自定義配置是日常開發(fā)中常見的需求,它允許我們以靈活的方式管理應(yīng)用的配置信息,無論是通過外部配置文件還是通過環(huán)境變量,本文是一個詳細(xì)的步驟說明,包括示例代碼,需要的朋友可以參考下
    2024-10-10
  • Spring Cloud Stream微服務(wù)消息框架原理及實例解析

    Spring Cloud Stream微服務(wù)消息框架原理及實例解析

    這篇文章主要介紹了Spring Cloud Stream微服務(wù)消息框架原理及實例解析,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-06-06
  • Java中的while無限循環(huán)結(jié)構(gòu)及實例

    Java中的while無限循環(huán)結(jié)構(gòu)及實例

    這篇文章主要介紹了Java中的while無限循環(huán)結(jié)構(gòu)及實例,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • 關(guān)于mybatis plus 中的查詢優(yōu)化問題

    關(guān)于mybatis plus 中的查詢優(yōu)化問題

    這篇文章主要介紹了關(guān)于mybatis plus 中的查詢優(yōu)化問題,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-01-01

最新評論

江达县| 册亨县| 东兴市| 驻马店市| 涞水县| 腾冲县| 绵竹市| 贵阳市| 宜城市| 庆云县| 宁南县| 商丘市| 平阴县| 汝阳县| 右玉县| 喀喇沁旗| 隆德县| 北海市| 宣化县| 扶绥县| 汨罗市| 大名县| 彭阳县| 郎溪县| 波密县| 赤峰市| 宽甸| 门头沟区| 桑日县| 榆树市| 开鲁县| 云霄县| 大理市| 宜黄县| 手游| 遂平县| 铁岭市| 子洲县| 永年县| 北海市| 古浪县|