日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

springCloud分布式事务实战(三)分布式事务处理器的编译和运行之注册中心编写与测试...

發(fā)布時間:2024/4/17 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 springCloud分布式事务实战(三)分布式事务处理器的编译和运行之注册中心编写与测试... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?SpringCloud注冊中心編寫和測試

(1)創(chuàng)建注冊中心工程

(2)添加jar包? pom.xml

<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.jh</groupId>

? <artifactId>TestSpringCloud</artifactId>

? <version>0.0.1-SNAPSHOT</version>

? <packaging>jar</packaging>

?

? <name>TestSpringCloud</name>

? <url>http://maven.apache.org</url>

?

? <properties>

??? <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

? </properties>

?

?

<!--? 1 spring boot parent? -->

??? <parent>

??????? <groupId>org.springframework.boot</groupId>

??????? <artifactId>spring-boot-starter-parent</artifactId>

??????? <version>1.4.3.RELEASE</version>

????? ??<relativePath/>

??? </parent>

?

? <!-- spring??? -->

?? <dependencies>

??????? ?<dependency>

??????????? <groupId>org.springframework.boot</groupId>

??????????? <artifactId>spring-boot-starter</artifactId>

??????? </dependency>

?

????? ???<!--2 注冊服務中心?? -->

??????? <dependency>

??????????? <groupId>org.springframework.cloud</groupId>

??????????? <artifactId>spring-cloud-starter-eureka-server</artifactId>

??????? </dependency>

??????? <!-- spring? boot 測試 -->

? ?????<dependency>

???????? ???<groupId>org.springframework.boot</groupId>

??????????? <artifactId>spring-boot-starter-test</artifactId>

??????????? <scope>test</scope>

??????? </dependency>

????????????????

?? <!-- spring cloud? 版本 -->

? </dependencies>

???? <dependencyManagement>

??????? <dependencies>

??????????? <dependency>

??????????????? <groupId>org.springframework.cloud</groupId>

??????????????? <artifactId>spring-cloud-dependencies</artifactId>

??????????????? <version>Dalston.SR3</version>

??????????????? <type>pom</type>

??????????????? <scope>import</scope>

??????????? </dependency>

??????? </dependencies>

??? </dependencyManagement>

</project>

(3) 編寫主程序

@EnableEurekaServer // 開啟注冊服務

@SpringBootApplication // spring boot應用程序

public class EurekaServer {

??? public static void main(String[] args) {

?????? SpringApplication.run(EurekaServer.class, args);

??? }

}

?

(4)配置文件application.properties

server.port=8001

eureka.instance.hostname=localhost

eureka.client.register-with-eureka=false

eureka.client.fetch-registry=false

eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:${server.port}/eureka/

?

(5)測試:

?打開瀏覽器輸入http://loclalhost:8001

?系統返回

?

?


轉載于:https://blog.51cto.com/14048134/2310471

總結

以上是生活随笔為你收集整理的springCloud分布式事务实战(三)分布式事务处理器的编译和运行之注册中心编写与测试...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。