diff --git a/gateway/pom.xml b/gateway/pom.xml new file mode 100644 index 0000000..3228809 --- /dev/null +++ b/gateway/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + com.yovinchen + train + 0.0.1-SNAPSHOT + + + gateway + + + + org.springframework.cloud + spring-cloud-starter-gateway + + + cn.hutool + hutool-all + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + + + 17 + 17 + UTF-8 + + + diff --git a/gateway/src/main/java/com/yovinchen/train/gateway/GatewayApplication.java b/gateway/src/main/java/com/yovinchen/train/gateway/GatewayApplication.java new file mode 100644 index 0000000..136aac4 --- /dev/null +++ b/gateway/src/main/java/com/yovinchen/train/gateway/GatewayApplication.java @@ -0,0 +1,30 @@ +package com.yovinchen.train.gateway; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.core.env.Environment; + +/** + * ClassName: GatewayApplication + * Package: com.yovinchen.train.gateway + * + * @author yovinchen + * @Create 2024/1/19 14:32 + */ +@SpringBootApplication +@ComponentScan("com.yovinchen") +public class GatewayApplication { + + private static final Logger LOG = LoggerFactory.getLogger(GatewayApplication.class); + + public static void main(String[] args) { + SpringApplication app = new SpringApplication(GatewayApplication.class); + Environment env = app.run(args) + .getEnvironment(); + LOG.info("启动成功!!"); + LOG.info("网关地址: \thttp://127.0.0.1:{}", env.getProperty("server.port")); + } +} diff --git a/gateway/src/main/resources/application.yml b/gateway/src/main/resources/application.yml new file mode 100644 index 0000000..00cff46 --- /dev/null +++ b/gateway/src/main/resources/application.yml @@ -0,0 +1,2 @@ +server: + port: 8000 diff --git a/gateway/src/main/resources/logback-spring.xml b/gateway/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..0c0e742 --- /dev/null +++ b/gateway/src/main/resources/logback-spring.xml @@ -0,0 +1,56 @@ + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %blue(%-50logger{50}:%-4line) %thread + %green(%-18X{LOG_ID}) %msg%n + + + + + + ${PATH}/trace.log + + ${PATH}/trace.%d{yyyy-MM-dd}.%i.log + + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %-50logger{50}:%-4line %green(%-18X{LOG_ID}) %msg%n + + + + + ${PATH}/error.log + + ${PATH}/error.%d{yyyy-MM-dd}.%i.log + + 10MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %-50logger{50}:%-4line %green(%-18X{LOG_ID}) %msg%n + + + ERROR + ACCEPT + DENY + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index c98fc0c..993068e 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,7 @@ member common + gateway 17