zoukankan      html  css  js  c++  java
  • spring cloud 服务相关配置

    1.注册中心

    1.1 添加pom依赖

    	<dependencies>
    		<dependency>
    			<groupId>org.springframework.cloud</groupId>
    			<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
    		</dependency>
    	</dependencies>
    
    	<build>
    		<finalName>${project.artifactId}</finalName><!--打jar包去掉版本号-->
    		<plugins>
    			<plugin>
    				<groupId>org.springframework.boot</groupId>
    				<artifactId>spring-boot-maven-plugin</artifactId>
    			</plugin>
    		</plugins>
    	</build>
    

    1.2 编写启动类

    @EnableEurekaServer
    @SpringBootApplication
    

    1.3 修改配置

    spring:
      application:
        name: register-center
    server:
      port: 8761
    eureka:
      client:
        serviceUrl:
          defaultZone: http://local.register.com:${server.port}/eureka/
        register-with-eureka: true
        fetch-registry: false
        registry-fetch-interval-seconds: 5
      instance:
        lease-expiration-duration-in-seconds: 15
        lease-renewal-interval-in-seconds: 5
        prefer-ip-address: true
        instance-id: ${spring.application.name}:${server.port}
      server:
        enable-self-preservation: false
        eviction-interval-timer-in-ms: 3000
    management:
      endpoints:
        web:
          exposure:
            include: "*"
      endpoint:
        health:
          show-details: always
    logging:
      level:
        root: info
      file: logs/${spring.application.name}.log
    
  • 相关阅读:
    eclipse如何设置多个字符的智能提示
    19.面向对象的三大特征 之封装
    18代码块
    成员变量和局部变量的区别
    类与对象
    Python压缩脚本编辑
    字符串内容
    参考
    序列
    元组
  • 原文地址:https://www.cnblogs.com/yiyangyu/p/spring8761.html
Copyright © 2011-2022 走看看