From 956bdb539634b3684111ba8780f4b8cd1e846f52 Mon Sep 17 00:00:00 2001 From: xiaofeng Date: Fri, 8 May 2020 22:30:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E9=A1=B9=E7=9B=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- order/order-application/pom.xml | 77 +------------------ .../order/application/OrderApplication.java | 23 ++++-- .../src/main/resources/application.yaml | 33 +------- 3 files changed, 21 insertions(+), 112 deletions(-) diff --git a/order/order-application/pom.xml b/order/order-application/pom.xml index 42d90ee09..2f80d4ffb 100644 --- a/order/order-application/pom.xml +++ b/order/order-application/pom.xml @@ -15,89 +15,16 @@ cn.iocoder.mall - common-framework + order-rest 1.0-SNAPSHOT cn.iocoder.mall - mall-spring-boot - 1.0-SNAPSHOT - - - cn.iocoder.mall - order-service-impl - 1.0-SNAPSHOT - - - cn.iocoder.mall - system-sdk - 1.0-SNAPSHOT - - - cn.iocoder.mall - user-sdk + order-rpc 1.0-SNAPSHOT - - - org.springframework.boot - spring-boot-starter-web - - - - io.springfox - springfox-swagger2 - - - com.github.xiaoymin - swagger-bootstrap-ui - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-sentinel - - - - - de.codecentric - spring-boot-admin-starter-client - - - - org.springframework.boot - spring-boot-starter-actuator - - - - io.micrometer - micrometer-registry-prometheus - - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - - org.springframework.boot - spring-boot-maven-plugin - - - diff --git a/order/order-application/src/main/java/cn/iocoder/mall/order/application/OrderApplication.java b/order/order-application/src/main/java/cn/iocoder/mall/order/application/OrderApplication.java index 6928ec3ff..7e1b99352 100644 --- a/order/order-application/src/main/java/cn/iocoder/mall/order/application/OrderApplication.java +++ b/order/order-application/src/main/java/cn/iocoder/mall/order/application/OrderApplication.java @@ -3,6 +3,7 @@ package cn.iocoder.mall.order.application; import org.apache.catalina.connector.Connector; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.context.config.ConfigFileApplicationListener; import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; @@ -11,16 +12,23 @@ import org.springframework.context.annotation.Bean; @SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.order"}) public class OrderApplication { - public static void main(String[] args) { - SpringApplication.run(OrderApplication.class, args); - } + /** + * 设置需要读取的配置文件的名字。 基于 {@link org.springframework.boot.context.config.ConfigFileApplicationListener#CONFIG_NAME_PROPERTY} + * 实现。 + */ + private static final String CONFIG_NAME_VALUE = "biz,rest,rpc,application"; + public static void main(String[] args) { + // 设置环境变量 + System.setProperty(ConfigFileApplicationListener.CONFIG_NAME_PROPERTY, CONFIG_NAME_VALUE); + SpringApplication.run(OrderApplication.class, args); + } /** - * 解决异常信息: - * java.lang.IllegalArgumentException: - * Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 + * 解决异常信息: java.lang.IllegalArgumentException: Invalid character found in the request target. + * The valid characters are defined in RFC 7230 and RFC 3986 + * * @return */ @Bean @@ -36,5 +44,4 @@ public class OrderApplication { } - -} \ No newline at end of file +} diff --git a/order/order-application/src/main/resources/application.yaml b/order/order-application/src/main/resources/application.yaml index a602900ae..17a49c062 100644 --- a/order/order-application/src/main/resources/application.yaml +++ b/order/order-application/src/main/resources/application.yaml @@ -1,32 +1,7 @@ spring: + # Application 的配置项 application: name: order-application - - # Spring Cloud 配置项 - cloud: - # Spring Cloud Sentinel 配置项 - sentinel: - transport: - dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址 - eager: true # 项目启动时,直接连接到 Sentinel - -# server -server: - port: 18088 - servlet: - context-path: /order-api/ - -swagger: - enable: true # 暂时不去掉 - title: 订单子系统 - description: 订单子系统 - version: 1.0.0 - base-package: cn.iocoder.mall.order.application.controller - -management: - endpoints: - web: - exposure: - include: health,info,env,metrics,prometheus - metrics: - enabled: true + # Profile 的配置项 + profiles: + active: local