mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
init
This commit is contained in:
@@ -26,19 +26,15 @@
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- ↓↓↓ 使用spring cloud zuul ↓↓↓
|
||||
如果要使用gateway需要注释掉
|
||||
|
||||
<!-- ↓↓↓ 使用spring cloud zuul ↓↓↓ -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- ↑↑↑ 使用spring cloud zuul ↑↑↑ -->
|
||||
|
||||
<!-- ↓↓↓ 使用spring cloud gateway ↓↓↓
|
||||
如果要使用zuul需要注释掉
|
||||
-->
|
||||
|
||||
<!-- ↓↓↓ 使用spring cloud gateway,处于beta阶段,推荐使用zuul ↓↓↓
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-gateway</artifactId>
|
||||
@@ -47,6 +43,7 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- ↑↑↑ 使用spring cloud gateway ↑↑↑ -->
|
||||
|
||||
<dependency>
|
||||
|
@@ -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 {
|
||||
|
||||
|
@@ -2,16 +2,27 @@ package com.gitee.sop.gateway.config;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.ApiContext;
|
||||
import com.gitee.sop.gatewaycommon.gateway.configuration.AlipayGatewayConfiguration;
|
||||
import com.gitee.sop.gatewaycommon.zuul.configuration.AlipayZuulConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 使用Spring Cloud Gateway
|
||||
*
|
||||
* 注意:下面两个只能使用一个。
|
||||
*
|
||||
* 使用前,前往启动类SopGatewayApplication.java 注释掉@EnableZuulProxy
|
||||
*/
|
||||
|
||||
/**
|
||||
* 开通支付宝开放平台能力
|
||||
* @author tanghc
|
||||
*/
|
||||
@Configuration
|
||||
|
||||
//@Configuration
|
||||
public class GatewayConfig extends AlipayGatewayConfiguration {
|
||||
|
||||
{
|
||||
@@ -33,3 +44,4 @@ public class GatewayConfig extends AlipayGatewayConfiguration {
|
||||
// ApiContext.getApiConfig().addAppSecret(appSecretStore);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
@@ -0,0 +1,45 @@
|
||||
package com.gitee.sop.gateway.config;
|
||||
|
||||
import com.gitee.sop.gatewaycommon.bean.ApiContext;
|
||||
import com.gitee.sop.gatewaycommon.zuul.configuration.AlipayZuulConfiguration;
|
||||
import com.gitee.sop.gatewaycommon.zuul.configuration.TaobaoZuulConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 使用Spring Cloud Zuul,推荐使用
|
||||
*
|
||||
* 注意:下面两个只能使用一个
|
||||
*/
|
||||
|
||||
/**
|
||||
* 开通支付宝开放平台能力
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开通支付宝开放平台能力
|
||||
* @author tanghc
|
||||
*/
|
||||
//@Configuration
|
||||
//public class ZuulConfig extends TaobaoZuulConfiguration {
|
||||
//
|
||||
// {
|
||||
// Map<String, String> appSecretStore = new HashMap();
|
||||
// appSecretStore.put("taobao_test", "G9w0BAQEFAAOCAQ8AMIIBCgKCA");
|
||||
// ApiContext.getApiConfig().addAppSecret(appSecretStore);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
server:
|
||||
port: 8081
|
||||
|
||||
|
||||
eureka:
|
||||
serverAddr: localhost:1111
|
||||
client:
|
||||
@@ -14,3 +15,4 @@ spring:
|
||||
locator:
|
||||
lower-case-service-id: true
|
||||
enabled: true
|
||||
|
||||
|
@@ -5,4 +5,7 @@ spring:
|
||||
|
||||
cloud:
|
||||
zookeeper:
|
||||
connect-string: localhost:2181
|
||||
connect-string: localhost:2181
|
||||
|
||||
zuul:
|
||||
servlet-path: /api # 入口地址,默认是/zuul
|
||||
|
Reference in New Issue
Block a user