From 98e0bbcaa6433dc63f47ab3ff3e5b66f9ad45f4e Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Fri, 21 Nov 2025 14:57:04 +0800 Subject: [PATCH] fix: demo --- .../modular/controller/TestController.java | 23 ++++++ .../src/main/resources/application.yml | 0 nl-common/pom.xml | 12 +++ nl-web-app/pom.xml | 26 +++++++ .../src/main/java/org/nl/Application.java | 74 +++++++++++++++++++ nl-web-app/src/main/java/org/nl/Main.java | 11 --- 6 files changed, 135 insertions(+), 11 deletions(-) create mode 100644 nl-business-setting/src/main/java/org/nl/setting/modular/controller/TestController.java create mode 100644 nl-business-setting/src/main/resources/application.yml create mode 100644 nl-web-app/src/main/java/org/nl/Application.java delete mode 100644 nl-web-app/src/main/java/org/nl/Main.java diff --git a/nl-business-setting/src/main/java/org/nl/setting/modular/controller/TestController.java b/nl-business-setting/src/main/java/org/nl/setting/modular/controller/TestController.java new file mode 100644 index 0000000..7390d47 --- /dev/null +++ b/nl-business-setting/src/main/java/org/nl/setting/modular/controller/TestController.java @@ -0,0 +1,23 @@ +package org.nl.setting.modular.controller; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author: lyd + * @Date: 2025/11/21 + */ + +@RequestMapping("/api") +@RestController +public class TestController { + + @GetMapping("/") + public ResponseEntity PressedMonitor() { + return new ResponseEntity<>("aaa", HttpStatus.OK); + } +} diff --git a/nl-business-setting/src/main/resources/application.yml b/nl-business-setting/src/main/resources/application.yml new file mode 100644 index 0000000..e69de29 diff --git a/nl-common/pom.xml b/nl-common/pom.xml index 62d8e74..e01f589 100644 --- a/nl-common/pom.xml +++ b/nl-common/pom.xml @@ -13,4 +13,16 @@ jar 基础通用模块 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.projectlombok + lombok + + diff --git a/nl-web-app/pom.xml b/nl-web-app/pom.xml index eb0bb9e..f79d4a2 100644 --- a/nl-web-app/pom.xml +++ b/nl-web-app/pom.xml @@ -42,6 +42,32 @@ org.nl nl-business-map + + + + junit + junit + test + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + com.baomidou + dynamic-datasource-spring-boot3-starter + + + + + com.mysql + mysql-connector-j + diff --git a/nl-web-app/src/main/java/org/nl/Application.java b/nl-web-app/src/main/java/org/nl/Application.java new file mode 100644 index 0000000..7506117 --- /dev/null +++ b/nl-web-app/src/main/java/org/nl/Application.java @@ -0,0 +1,74 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package org.nl; + +import lombok.SneakyThrows; +import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.Banner; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.Environment; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * SpringBoot方式启动类 + * + * @author xuyuxiang + * @date 2021/12/18 16:57 + */ +@Slf4j +@RestController +@SpringBootApplication +public class Application { + + /* 解决druid 日志报错:discard long time none received connection:xxx */ + static { + System.setProperty("druid.mysql.usePingMethod","false"); + } + + /** + * 主启动函数 + * + * @author xuyuxiang + * @date 2022/7/30 21:42 + */ + @SneakyThrows + public static void main(String[] args) { + SpringApplication springApplication = new SpringApplication(Application.class); + springApplication.setBannerMode(Banner.Mode.OFF); + ConfigurableApplicationContext configurableApplicationContext = springApplication.run(args); + Environment env = configurableApplicationContext.getEnvironment(); + log.info(""" + + ---------------------------------------------------------- + Application is running! Access URLs: + Local: http://localhost:{} + Doc: http://localhost:{}/doc.html + ----------------------------------------------------------""", + env.getProperty("server.port"), + env.getProperty("server.port")); + } + + /** + * 首页 + * + * @author xuyuxiang + * @date 2022/7/8 14:22 + **/ + @GetMapping("/") + public String index() { + return "WELCOME"; + } +} diff --git a/nl-web-app/src/main/java/org/nl/Main.java b/nl-web-app/src/main/java/org/nl/Main.java deleted file mode 100644 index f5a7db3..0000000 --- a/nl-web-app/src/main/java/org/nl/Main.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.nl; - -/** - * @Author: lyd - * @Date: ${DATE} - */ -public class Main { - public static void main(String[] args) { - System.out.println("Hello world!"); - } -}