Spring Cloud Hoxton

一. 项目搭建

  1. yml引用maven变量
    在pom.yml中设置环境

        
            dev
            
                true
            
            
                dev
                127.0.0.1:8848
                127.0.0.1:8848
                DEV 
            
        
        
            test
            
                test
                192.168.48.200:8848
                192.168.48.200:8848
                
            
        
    

在maven中配置替换占位符


        
            
                src/main/resources
                true
            
        

在yml中使用变量

spring:
        profiles:
            active: '@profile.name@'  # dev

另外可以设置${}格式也可以使用maven中的变量


        ${project.name}
        
            
                src/main/resources
                true
            
        
        
            
            
                
                    maven-resources-plugin
                    
                        utf-8
                        true
                    
                
            
        
        
        
    
  1. gateway 查看路由信息
    pom中引入依赖

        org.springframework.boot
        spring-boot-starter-actuator

配置文件中暴露端口

management:
    endpoints:
        web:
            exposure:
                include: "*"
    endpoint:
        health:
            show-details: ALWAYS

url : http://localhost:8888/actuator/gateway/routes
类 : GatewayControllerEndpoint

你可能感兴趣的:(Spring Cloud Hoxton)