mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
4.0
This commit is contained in:
@@ -17,17 +17,17 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--
|
||||
<artifactId>sop-bridge-nacos</artifactId> : 使用nacos注册中心
|
||||
<artifactId>sop-bridge-eureka</artifactId> : 使用eureka注册中心
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>com.gitee.sop</groupId>
|
||||
<artifactId>sop-gateway-common</artifactId>
|
||||
<artifactId>sop-bridge-nacos</artifactId>
|
||||
<!--<artifactId>sop-bridge-eureka</artifactId>-->
|
||||
<version>3.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
@@ -4,8 +4,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.alibaba.fastjson.support.config.FastJsonConfig;
|
||||
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
|
||||
import com.gitee.sop.gatewaycommon.manager.EnvironmentContext;
|
||||
import com.gitee.sop.gatewaycommon.route.EurekaRegistryListener;
|
||||
import com.gitee.sop.gatewaycommon.route.NacosRegistryListener;
|
||||
import com.gitee.sop.gatewaycommon.route.RegistryListener;
|
||||
import com.gitee.sop.gatewaycommon.route.ServiceListener;
|
||||
import com.gitee.sop.websiteserver.listener.ServiceDocListener;
|
||||
@@ -14,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
import org.springframework.cloud.client.discovery.event.HeartbeatEvent;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
@@ -65,21 +62,6 @@ public class WebsiteConfig implements ApplicationRunner {
|
||||
registryListener.onEvent(heartbeatEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* 微服务路由加载
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnProperty("spring.cloud.nacos.discovery.server-addr")
|
||||
RegistryListener registryListenerNacos() {
|
||||
return new NacosRegistryListener();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty("eureka.client.serviceUrl.defaultZone")
|
||||
RegistryListener registryListenerEureka() {
|
||||
return new EurekaRegistryListener();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
ServiceListener serviceListener() {
|
||||
|
2
sop-website/src/main/resources/META-INF/spring.factories
Normal file
2
sop-website/src/main/resources/META-INF/spring.factories
Normal file
@@ -0,0 +1,2 @@
|
||||
# 自定义自动配置类,如果有多个类,使用逗号(,)分隔,\正斜杠标示换行还可以读取到指定的类
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.gitee.sop.bridge.SopRegisterAutoConfiguration
|
@@ -2,8 +2,8 @@ server.port=8083
|
||||
spring.application.name=sop-website
|
||||
|
||||
# ------- 需要改的配置 -------
|
||||
# nacos地址
|
||||
nacos.url=127.0.0.1:8848
|
||||
# 注册中心地址
|
||||
register.url=127.0.0.1:8848
|
||||
|
||||
# 网关内网地址
|
||||
# !!沙箱环境是提供给外部的测试环境,不能把正式环境当做沙箱环境来使用。
|
||||
@@ -11,7 +11,9 @@ gateway.url=http://localhost:8081
|
||||
# ------- 需要改的配置end -------
|
||||
|
||||
## nacos cloud配置
|
||||
spring.cloud.nacos.discovery.server-addr=${nacos.url}
|
||||
spring.cloud.nacos.discovery.server-addr=${register.url}
|
||||
# eureka地址
|
||||
eureka.client.serviceUrl.defaultZone=${register.url}
|
||||
|
||||
# 页面上显示的测试环境地址
|
||||
api.url-test=http://open-test.yourdomain.com
|
||||
|
Reference in New Issue
Block a user