• TX-LCN分布式事务-- LCN事务模式(eureka模块)


    自己学习用,待补充!

    工程结构 :

    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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.4.5</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.wondersgroup</groupId>
        <artifactId>eureka-server</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>eureka-server</name>
        <description>eureka-server</description>
        <properties>
            <java.version>1.8</java.version>
            <spring-cloud.version>2020.0.2</spring-cloud.version>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
                <version>2.2.4.RELEASE</version>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-dependencies</artifactId>
                    <version>${spring-cloud.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>

    yml:

    server:
      port: 7900
    
    # 指定当前eureka客户端的注册地址,也就是eureka服务的提供方,当前配置的服务的注册服务方
    eureka:
      client:
        service-url:
          defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka
        register-with-eureka: false #自身 不在向eureka注册
        fetch-registry: false  #启动时禁用client的注册
      instance:
        hostname: localhost
      server:
        enable-self-preservation: false #自我保护机制
        eviction-interval-timer-in-ms: 5000  #及时踢出已关停的节点
    
    #指定应用名称
    spring:
      application:
        name: eureka-server

    启动类 :

  • 相关阅读:
    JavaScript之作用域和闭包
    mui.openWindow的html5+和web传参的兼容
    HTML5地理定位-Geolocation API
    wepy 编译警告去除办法
    Angular网络请求的封装
    网页资源加载的优化方法
    小DEMO之manifest初体验
    HDU 2846 Repository (字典树 后缀建树)
    mongodb适用和不适用的应用场景
    Codeforces 240E. Road Repairs 最小树形图+输出路径
  • 原文地址:https://www.cnblogs.com/lifan12589/p/14722930.html
Copyright © 2020-2023  润新知