commit
f8e4c55589
4 changed files with 155 additions and 0 deletions
@ -0,0 +1,93 @@ |
|||||
|
<?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.ccsens</groupId> |
||||
|
<artifactId>gateway</artifactId> |
||||
|
<version>1.0-SNAPSHOT</version> |
||||
|
|
||||
|
<parent> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-parent</artifactId> |
||||
|
<version>2.0.6.RELEASE</version> |
||||
|
<relativePath/> <!-- lookup parent from repository --> |
||||
|
</parent> |
||||
|
|
||||
|
<properties> |
||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
|
<java.version>1.8</java.version> |
||||
|
</properties> |
||||
|
|
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-data-redis</artifactId> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-jdbc</artifactId> |
||||
|
</dependency> |
||||
|
<!--<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-web</artifactId> |
||||
|
</dependency>--> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-devtools</artifactId> |
||||
|
<scope>runtime</scope> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-configuration-processor</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.projectlombok</groupId> |
||||
|
<artifactId>lombok</artifactId> |
||||
|
<optional>true</optional> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-test</artifactId> |
||||
|
<scope>test</scope> |
||||
|
</dependency> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.boot</groupId> |
||||
|
<artifactId>spring-boot-starter-actuator</artifactId> |
||||
|
</dependency> |
||||
|
<!--eureka client--> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
||||
|
</dependency> |
||||
|
<!--gateway--> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.cloud</groupId> |
||||
|
<artifactId>spring-cloud-starter-gateway</artifactId> |
||||
|
</dependency> |
||||
|
</dependencies> |
||||
|
|
||||
|
<!-- 引入spring cloud的依赖,不能少,主要用来管理Spring Cloud生态各组件的版本 --> |
||||
|
<dependencyManagement> |
||||
|
<dependencies> |
||||
|
<dependency> |
||||
|
<groupId>org.springframework.cloud</groupId> |
||||
|
<artifactId>spring-cloud-dependencies</artifactId> |
||||
|
<version>Finchley.SR2</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> |
||||
@ -0,0 +1,17 @@ |
|||||
|
package com.ccsens.gateway; |
||||
|
|
||||
|
import org.springframework.boot.SpringApplication; |
||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication; |
||||
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
||||
|
|
||||
|
/** |
||||
|
* @description: |
||||
|
* @author: wuHuiJuan |
||||
|
* @create: 2019/11/27 14:35 |
||||
|
*/ |
||||
|
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) |
||||
|
public class GatewayApplication { |
||||
|
public static void main(String[] args) { |
||||
|
SpringApplication.run(GatewayApplication.class, args); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
server: |
||||
|
port: 7020 |
||||
|
#服务端点暴露 |
||||
|
management: |
||||
|
endpoints: |
||||
|
web: |
||||
|
exposure: |
||||
|
# 暴露xxx端点,如需暴露多个,用,分隔;如需暴露所有端点,用'*' |
||||
|
include: auditevents,caches,conditions,flyway,health,heapdump,httptrace,info,integrationgraph,jolokia,logfile,loggers,liquibase,metrics,mappings,prometheus,scheduledtasks,sessions,shutdown,threaddump |
||||
|
endpoint: |
||||
|
health: |
||||
|
# 是否展示健康检查详情 |
||||
|
show-details: always |
||||
|
health: |
||||
|
redis: |
||||
|
enabled: false |
||||
|
#eureka注册 |
||||
|
eureka: |
||||
|
client: |
||||
|
service-url: |
||||
|
# 指定eureka server通信地址,注意/eureka/小尾巴不能少 |
||||
|
#defaultZone: http://admin:admin@peer1:8761/eureka/,http://admin:admin@peer2:8762/eureka/ |
||||
|
defaultZone: http://admin:admin@127.0.0.1:7010/eureka/ |
||||
|
instance: |
||||
|
# 是否注册IP到eureka server,如不指定或设为false,那就回注册主机名到eureka server |
||||
|
prefer-ip-address: true |
||||
|
spring: |
||||
|
application: |
||||
|
name: gateway |
||||
|
cloud: |
||||
|
gateway: |
||||
|
routes: |
||||
|
- id: ht-service |
||||
|
uri: lb://ht |
||||
|
predicates: |
||||
|
- Path=/ht-test/** |
||||
|
discovery: |
||||
|
locator: |
||||
|
enabled: true |
||||
|
lower-case-service-id: true |
||||
|
main: |
||||
|
allow-bean-definition-overriding: true |
||||
@ -0,0 +1,3 @@ |
|||||
|
spring: |
||||
|
profiles: |
||||
|
active: dev |
||||
Loading…
Reference in new issue