mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
gateway init
This commit is contained in:
@@ -26,10 +26,10 @@
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.springframework.cloud</groupId>-->
|
||||
<!--<artifactId>spring-cloud-starter-netflix-zuul</artifactId>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
|
@@ -2,10 +2,10 @@ package com.gitee.sop.gateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
|
||||
//import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
|
||||
|
||||
// 开启网关功能
|
||||
@EnableZuulProxy
|
||||
//@EnableZuulProxy
|
||||
@SpringBootApplication
|
||||
public class SopGatewayApplication {
|
||||
|
||||
|
@@ -0,0 +1,36 @@
|
||||
package com.gitee.sop.gateway.config;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.ApiContext;
|
||||
import com.gitee.sop.gatewaycommon.configuration.AlipayGatewayConfiguration;
|
||||
import com.gitee.sop.gatewaycommon.configuration.TaobaoGatewayConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 开通支付宝开放平台能力
|
||||
* @author tanghc
|
||||
*/
|
||||
//@Configuration
|
||||
//public class GatewayConfig extends AlipayGatewayConfiguration {
|
||||
//
|
||||
// {
|
||||
// Map<String, String> appSecretStore = new HashMap();
|
||||
// appSecretStore.put("alipay_test", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlyb9aUBaljQP/vjmBFe1mF8HsWSvyfC2NTlpT/V9E+sBxTr8TSkbzJCeeeOEm4LCaVXL0Qz63MZoT24v7AIXTuMdj4jyiM/WJ4tjrWAgnmohNOegfntTto16C3l234vXz4ryWZMR/7W+MXy5B92wPGQEJ0LKFwNEoLspDEWZ7RdE53VH7w6y6sIZUfK+YkXWSwehfKPKlx+lDw3zRJ3/yvMF+U+BAdW/MfECe1GuBnCFKnlMRh3UKczWyXWkL6ItOpYHHJi/jx85op5BWDje2pY9QowzfN94+0DB3T7UvZeweu3zlP6diwAJDzLaFQX8ULfWhY+wfKxIRgs9NoiSAQIDAQAB");
|
||||
// ApiContext.getApiConfig().addAppSecret(appSecretStore);
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 开通淘宝开放平能力
|
||||
*/
|
||||
@Configuration
|
||||
public class GatewayConfig extends TaobaoGatewayConfiguration {
|
||||
|
||||
{
|
||||
Map<String, String> appSecretStore = new HashMap();
|
||||
appSecretStore.put("taobao_test", "G9w0BAQEFAAOCAQ8AMIIBCgKCA");
|
||||
ApiContext.getApiConfig().addAppSecret(appSecretStore);
|
||||
}
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
package com.gitee.sop.gateway.config;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.ApiContext;
|
||||
import com.gitee.sop.gatewaycommon.configuration.AlipayZuulConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 开通支付宝开放平台能力
|
||||
* @author tanghc
|
||||
*/
|
||||
@Configuration
|
||||
public class ZuulConfig extends AlipayZuulConfiguration {
|
||||
|
||||
{
|
||||
Map<String, String> appSecretStore = new HashMap();
|
||||
appSecretStore.put("alipay_test", "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlyb9aUBaljQP/vjmBFe1mF8HsWSvyfC2NTlpT/V9E+sBxTr8TSkbzJCeeeOEm4LCaVXL0Qz63MZoT24v7AIXTuMdj4jyiM/WJ4tjrWAgnmohNOegfntTto16C3l234vXz4ryWZMR/7W+MXy5B92wPGQEJ0LKFwNEoLspDEWZ7RdE53VH7w6y6sIZUfK+YkXWSwehfKPKlx+lDw3zRJ3/yvMF+U+BAdW/MfECe1GuBnCFKnlMRh3UKczWyXWkL6ItOpYHHJi/jx85op5BWDje2pY9QowzfN94+0DB3T7UvZeweu3zlP6diwAJDzLaFQX8ULfWhY+wfKxIRgs9NoiSAQIDAQAB");
|
||||
ApiContext.getApiConfig().addAppSecret(appSecretStore);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开通淘宝开放平能力
|
||||
*/
|
||||
//@Configuration
|
||||
//public class ZuulConfig extends TaobaoZuulConfiguration {
|
||||
//
|
||||
// {
|
||||
// Map<String, String> appSecretStore = new HashMap();
|
||||
// appSecretStore.put("taobao_test", "G9w0BAQEFAAOCAQ8AMIIBCgKCA");
|
||||
// ApiContext.getApiConfig().addAppSecret(appSecretStore);
|
||||
// }
|
||||
//}
|
@@ -1,28 +0,0 @@
|
||||
server.port=8081
|
||||
spring.application.name=api-gateway
|
||||
|
||||
# 注册中心
|
||||
eureka.host=localhost
|
||||
eureka.port=1111
|
||||
eureka.client.serviceUrl.defaultZone=http://${eureka.host}:${eureka.port}/eureka/
|
||||
|
||||
# 入口地址,默认是/zuul
|
||||
zuul.servlet-path=/api
|
||||
|
||||
# 路由配置
|
||||
# story服务路由配置
|
||||
# 内置有个默认的:
|
||||
# zuul.routes.<name>.path=/<服务名>/**
|
||||
# zuul.routes.<name>.serviceId=<服务名>
|
||||
# 等同于:
|
||||
# zuul.routes.<服务名>=/<服务名>/**
|
||||
|
||||
|
||||
# Redis数据库索引(默认为0)
|
||||
spring.redis.database=0
|
||||
# Redis服务器地址
|
||||
spring.redis.host=127.0.0.1
|
||||
# Redis服务器连接端口
|
||||
spring.redis.port=6379
|
||||
# Redis服务器连接密码(默认为空)
|
||||
spring.redis.password=
|
16
sop-gateway/src/main/resources/application.yml
Normal file
16
sop-gateway/src/main/resources/application.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
server:
|
||||
port: 8081
|
||||
|
||||
eureka:
|
||||
serverAddr: localhost:1111
|
||||
client:
|
||||
serviceUrl:
|
||||
defaultZone: http://${eureka.serverAddr}/eureka/
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
lower-case-service-id: true
|
||||
enabled: true
|
8
sop-gateway/src/main/resources/bootstrap.yml
Normal file
8
sop-gateway/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: api-gateway
|
||||
|
||||
cloud:
|
||||
zookeeper:
|
||||
connect-string: localhost:2181
|
Reference in New Issue
Block a user