• springcloud Zuul consul


    spring:
        application:
            name: myclouds-gateway-consul
        cloud:
            consul:
              host: 127.0.0.1
              port: 8500
              enabled: true
              discovery:
                enabled: true
                register: true
    server:
        port: 5556
    
    zuul:
      routes:
        myadmin: #routes 1。访问路径:http://127.0.0.1:5556/test/user/get?token=1&&id=1
          path: /test/**
          serviceId: myadmin-service
           
    management:
       security:
           enabled:false
    endpoints:
        health:
            enabled:true
            sensitive:false
        metrics:
           enabled:true
           sensitive:false
    <?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>
    
        <groupId>com.gitee.myclouds</groupId>
        <artifactId>myclouds-gateway</artifactId>
        <version>1.0</version>
    
        <packaging>jar</packaging>
    
        <name>myclouds-gateway</name>
        <description>myclouds服务网关</description>
        
            <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
            <java.version>1.8</java.version>
        </properties>
    
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>1.5.8.RELEASE</version>
            <relativePath /> <!-- lookup parent from repository -->
        </parent>
    
        <dependencyManagement>
            <dependencies>
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-dependencies</artifactId>
                    <version>Dalston.SR4</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>
    
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
            
           <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-zuul</artifactId>
            </dependency>
            
             <!-- 增加spring-boot-actuator是为了项目可以访问/health 路径来判断服务是否健康 -->
            <dependency>  
                <groupId>org.springframework.boot</groupId>  
                <artifactId>spring-boot-starter-actuator</artifactId>  
            </dependency>
    
            <!-- Web应用依赖 -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
    
            <!-- 开发阶段的热部署支持 -->
    <!--         <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <optional>true</optional>
            </dependency> -->
            
            <dependency>
                <groupId>com.gitee.myclouds</groupId>
                <artifactId>myclouds-toolbox</artifactId>
                <version>1.0</version>
            </dependency>
            
            <!-- consul服务发现 -->
             <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-consul-discovery</artifactId>
            </dependency>
    
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <configuration>
                        <fork>true</fork>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
        <repositories>
            <repository>
                <id>spring-milestones</id>
                <name>Spring Milestones</name>
                <url>https://repo.spring.io/milestone</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
        </repositories>
    
    
    </project>
  • 相关阅读:
    The Stanford Natural Language Processing Group
    HTTP和Socket
    数据挖掘之R与SQL
    redis运维的一些知识点
    ICTCLAS2011免费发布
    异步IO一定更好吗?
    试用wincvs2.0
    本地访问服务器上的wamp
    如何解决wamp中apache外部IP访问问题
    高级设置电脑系统windows7防火墙出错代码0×6D9原因与解决技巧
  • 原文地址:https://www.cnblogs.com/rigid/p/9035595.html
Copyright © 2020-2023  润新知