mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-11-04 10:57:10 +08:00 
			
		
		
		
	first commit
This commit is contained in:
		
							
								
								
									
										41
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					HELP.md
 | 
				
			||||||
 | 
					target/
 | 
				
			||||||
 | 
					!.mvn/wrapper/maven-wrapper.jar
 | 
				
			||||||
 | 
					!**/src/main/**/target/
 | 
				
			||||||
 | 
					!**/src/test/**/target/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### STS ###
 | 
				
			||||||
 | 
					.apt_generated
 | 
				
			||||||
 | 
					.classpath
 | 
				
			||||||
 | 
					.factorypath
 | 
				
			||||||
 | 
					.project
 | 
				
			||||||
 | 
					.settings
 | 
				
			||||||
 | 
					.springBeans
 | 
				
			||||||
 | 
					.sts4-cache
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### IntelliJ IDEA ###
 | 
				
			||||||
 | 
					.idea
 | 
				
			||||||
 | 
					*.iws
 | 
				
			||||||
 | 
					*.iml
 | 
				
			||||||
 | 
					*.ipr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### NetBeans ###
 | 
				
			||||||
 | 
					/nbproject/private/
 | 
				
			||||||
 | 
					/nbbuild/
 | 
				
			||||||
 | 
					/dist/
 | 
				
			||||||
 | 
					/nbdist/
 | 
				
			||||||
 | 
					/.nb-gradle/
 | 
				
			||||||
 | 
					build/
 | 
				
			||||||
 | 
					!**/src/main/**/build/
 | 
				
			||||||
 | 
					!**/src/test/**/build/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### VS Code ###
 | 
				
			||||||
 | 
					.vscode/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Temp ###
 | 
				
			||||||
 | 
					*.log
 | 
				
			||||||
 | 
					*.logs
 | 
				
			||||||
 | 
					*.cache
 | 
				
			||||||
 | 
					*.diff
 | 
				
			||||||
 | 
					*.patch
 | 
				
			||||||
 | 
					*.tmp
 | 
				
			||||||
							
								
								
									
										21
									
								
								LICENSE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								LICENSE
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					The MIT License (MIT)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright © 2022-present Charles7c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
				
			||||||
 | 
					of this software and associated documentation files (the "Software"), to deal
 | 
				
			||||||
 | 
					in the Software without restriction, including without limitation the rights
 | 
				
			||||||
 | 
					to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
				
			||||||
 | 
					copies of the Software, and to permit persons to whom the Software is
 | 
				
			||||||
 | 
					furnished to do so, subject to the following conditions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The above copyright notice and this permission notice shall be included in
 | 
				
			||||||
 | 
					all copies or substantial portions of the Software.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
				
			||||||
 | 
					IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
				
			||||||
 | 
					FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
				
			||||||
 | 
					AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
				
			||||||
 | 
					LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
				
			||||||
 | 
					OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
				
			||||||
 | 
					THE SOFTWARE.
 | 
				
			||||||
							
								
								
									
										21
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					# ContiNew-Admin 中后台管理框架
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[](https://github.com/Charles7c/continew-admin/blob/dev/LICENSE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 简介
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ContiNew-Admin (incubating) 中后台管理框架,Continue New Admin,持续以最新流行技术栈构建。当前阶段采用的技术栈:Spring Boot 等。
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 技术栈
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					| 名称                                                  | 版本    | 简介                                                         |
 | 
				
			||||||
 | 
					| ----------------------------------------------------- | ------- | ------------------------------------------------------------ |
 | 
				
			||||||
 | 
					| [Spring Boot](https://spring.io/projects/spring-boot) | 2.7.6   | 简化新 Spring 应用的初始搭建以及开发过程。                   |
 | 
				
			||||||
 | 
					| [Lombok](https://projectlombok.org/)                  | 1.18.24 | 在 Java 开发过程中用注解的方式,简化了 JavaBean 的编写,避免了冗余和样板式代码,让编写的类更加简洁。 |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### License
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- 遵循 [MIT](https://github.com/Charles7c/continew-admin/blob/dev/LICENSE) 开源许可协议
 | 
				
			||||||
 | 
					- Copyright © 2022-present Charles7c
 | 
				
			||||||
							
								
								
									
										141
									
								
								pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								pom.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,141 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<project xmlns="http://maven.apache.org/POM/4.0.0"
 | 
				
			||||||
 | 
					         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 | 
				
			||||||
 | 
					         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
				
			||||||
 | 
					    <modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <parent>
 | 
				
			||||||
 | 
					        <groupId>org.springframework.boot</groupId>
 | 
				
			||||||
 | 
					        <artifactId>spring-boot-starter-parent</artifactId>
 | 
				
			||||||
 | 
					        <version>2.7.6</version>
 | 
				
			||||||
 | 
					        <relativePath/> <!-- lookup parent from repository -->
 | 
				
			||||||
 | 
					    </parent>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <groupId>top.charles7c</groupId>
 | 
				
			||||||
 | 
					    <artifactId>continew-admin</artifactId>
 | 
				
			||||||
 | 
					    <version>0.0.1-SNAPSHOT</version>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <name>${project.artifactId}</name>
 | 
				
			||||||
 | 
					    <description>ContiNew-Admin (incubating) 中后台管理框架,Continue New Admin,持续以最新流行技术栈构建。</description>
 | 
				
			||||||
 | 
					    <url>https://github.com/Charles7c/continew-admin</url>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <properties>
 | 
				
			||||||
 | 
					        <!-- ### 基础环境相关 ### -->
 | 
				
			||||||
 | 
					        <java.version>1.8</java.version>
 | 
				
			||||||
 | 
					        <maven.compiler.source>8</maven.compiler.source>
 | 
				
			||||||
 | 
					        <maven.compiler.target>8</maven.compiler.target>
 | 
				
			||||||
 | 
					        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 | 
				
			||||||
 | 
					    </properties>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <dependencies>
 | 
				
			||||||
 | 
					        <!-- ################ Spring Boot 相关 ################ -->
 | 
				
			||||||
 | 
					        <!-- Spring Boot Web(提供 Spring MVC Web 开发能力,默认内置 Tomcat 服务器) -->
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>org.springframework.boot</groupId>
 | 
				
			||||||
 | 
					            <artifactId>spring-boot-starter-web</artifactId>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>org.springframework.boot</groupId>
 | 
				
			||||||
 | 
					            <artifactId>spring-boot-devtools</artifactId>
 | 
				
			||||||
 | 
					            <scope>runtime</scope>
 | 
				
			||||||
 | 
					            <optional>true</optional>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>org.springframework.boot</groupId>
 | 
				
			||||||
 | 
					            <artifactId>spring-boot-configuration-processor</artifactId>
 | 
				
			||||||
 | 
					            <optional>true</optional>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>org.springframework.boot</groupId>
 | 
				
			||||||
 | 
					            <artifactId>spring-boot-starter-test</artifactId>
 | 
				
			||||||
 | 
					            <scope>test</scope>
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <!-- Lombok(在 Java 开发过程中用注解的方式,简化了 JavaBean 的编写,避免了冗余和样板式代码,让编写的类更加简洁) -->
 | 
				
			||||||
 | 
					        <dependency>
 | 
				
			||||||
 | 
					            <groupId>org.projectlombok</groupId>
 | 
				
			||||||
 | 
					            <artifactId>lombok</artifactId>
 | 
				
			||||||
 | 
					            <optional>true</optional> <!-- 表示依赖不会被传递 -->
 | 
				
			||||||
 | 
					        </dependency>
 | 
				
			||||||
 | 
					    </dependencies>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <build>
 | 
				
			||||||
 | 
					        <!-- 设置构建的 jar 包名 -->
 | 
				
			||||||
 | 
					        <finalName>${project.name}</finalName>
 | 
				
			||||||
 | 
					        <plugins>
 | 
				
			||||||
 | 
					            <plugin>
 | 
				
			||||||
 | 
					                <groupId>org.apache.maven.plugins</groupId>
 | 
				
			||||||
 | 
					                <artifactId>maven-surefire-plugin</artifactId>
 | 
				
			||||||
 | 
					                <configuration>
 | 
				
			||||||
 | 
					                    <argLine>-Dfile.encoding=UTF-8</argLine>
 | 
				
			||||||
 | 
					                    <!-- 根据启用环境执行对应 @Tag 的测试方法 -->
 | 
				
			||||||
 | 
					                    <groups>${profiles.active}</groups>
 | 
				
			||||||
 | 
					                    <!-- 排除标签 -->
 | 
				
			||||||
 | 
					                    <excludedGroups>exclude</excludedGroups>
 | 
				
			||||||
 | 
					                </configuration>
 | 
				
			||||||
 | 
					            </plugin>
 | 
				
			||||||
 | 
					            <plugin>
 | 
				
			||||||
 | 
					                <groupId>org.springframework.boot</groupId>
 | 
				
			||||||
 | 
					                <artifactId>spring-boot-maven-plugin</artifactId>
 | 
				
			||||||
 | 
					                <executions>
 | 
				
			||||||
 | 
					                    <execution>
 | 
				
			||||||
 | 
					                        <goals>
 | 
				
			||||||
 | 
					                            <goal>repackage</goal>
 | 
				
			||||||
 | 
					                        </goals>
 | 
				
			||||||
 | 
					                    </execution>
 | 
				
			||||||
 | 
					                </executions>
 | 
				
			||||||
 | 
					                <configuration>
 | 
				
			||||||
 | 
					                    <!-- 如果没有该项配置,devtools 不会生效,应用不会自动重启 -->
 | 
				
			||||||
 | 
					                    <fork>true</fork>
 | 
				
			||||||
 | 
					                    <excludes>
 | 
				
			||||||
 | 
					                        <exclude>
 | 
				
			||||||
 | 
					                            <groupId>org.projectlombok</groupId>
 | 
				
			||||||
 | 
					                            <artifactId>lombok</artifactId>
 | 
				
			||||||
 | 
					                        </exclude>
 | 
				
			||||||
 | 
					                    </excludes>
 | 
				
			||||||
 | 
					                </configuration>
 | 
				
			||||||
 | 
					            </plugin>
 | 
				
			||||||
 | 
					        </plugins>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <resources>
 | 
				
			||||||
 | 
					            <resource>
 | 
				
			||||||
 | 
					                <directory>src/main/resources</directory>
 | 
				
			||||||
 | 
					                <includes>
 | 
				
			||||||
 | 
					                    <include>**/**</include>
 | 
				
			||||||
 | 
					                </includes>
 | 
				
			||||||
 | 
					                <!-- 启用过滤,即该资源中的变量将会被替换 -->
 | 
				
			||||||
 | 
					                <filtering>true</filtering>
 | 
				
			||||||
 | 
					            </resource>
 | 
				
			||||||
 | 
					        </resources>
 | 
				
			||||||
 | 
					    </build>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <profiles>
 | 
				
			||||||
 | 
					        <profile>
 | 
				
			||||||
 | 
					            <id>dev</id>
 | 
				
			||||||
 | 
					            <!-- 自定义属性配置 -->
 | 
				
			||||||
 | 
					            <properties>
 | 
				
			||||||
 | 
					                <!-- Spring Boot 启用环境 -->
 | 
				
			||||||
 | 
					                <profiles.active>dev</profiles.active>
 | 
				
			||||||
 | 
					                <!-- 日志级别 -->
 | 
				
			||||||
 | 
					                <logging.level>debug</logging.level>
 | 
				
			||||||
 | 
					                <!-- 日志存储位置 -->
 | 
				
			||||||
 | 
					                <logging.file.path>./logs</logging.file.path>
 | 
				
			||||||
 | 
					            </properties>
 | 
				
			||||||
 | 
					            <activation>
 | 
				
			||||||
 | 
					                <!-- 默认启用 -->
 | 
				
			||||||
 | 
					                <activeByDefault>true</activeByDefault>
 | 
				
			||||||
 | 
					            </activation>
 | 
				
			||||||
 | 
					        </profile>
 | 
				
			||||||
 | 
					        <profile>
 | 
				
			||||||
 | 
					            <id>prod</id>
 | 
				
			||||||
 | 
					            <properties>
 | 
				
			||||||
 | 
					                <profiles.active>prod</profiles.active>
 | 
				
			||||||
 | 
					                <logging.level>info</logging.level>
 | 
				
			||||||
 | 
					                <logging.file.path>./logs</logging.file.path>
 | 
				
			||||||
 | 
					            </properties>
 | 
				
			||||||
 | 
					        </profile>
 | 
				
			||||||
 | 
					    </profiles>
 | 
				
			||||||
 | 
					</project>
 | 
				
			||||||
							
								
								
									
										48
									
								
								src/main/java/top/charles7c/ContinewAdminApplication.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/main/java/top/charles7c/ContinewAdminApplication.java
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					package top.charles7c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.SneakyThrows;
 | 
				
			||||||
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
 | 
					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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.net.InetAddress;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 启动程序
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @author Charles7c
 | 
				
			||||||
 | 
					 * @since 2022/12/8 23:15
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Slf4j
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@SpringBootApplication
 | 
				
			||||||
 | 
					public class ContinewAdminApplication {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private static Environment env;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @SneakyThrows
 | 
				
			||||||
 | 
					    public static void main(String[] args) {
 | 
				
			||||||
 | 
					        SpringApplication application = new SpringApplication(ContinewAdminApplication.class);
 | 
				
			||||||
 | 
					        ConfigurableApplicationContext context = application.run(args);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        env = context.getEnvironment();
 | 
				
			||||||
 | 
					        log.info("------------------------------------------------------");
 | 
				
			||||||
 | 
					        log.info("{} backend service started successfully.", env.getProperty("continew-admin.name"));
 | 
				
			||||||
 | 
					        log.info("后端 API 地址:http://{}:{}", InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"));
 | 
				
			||||||
 | 
					        log.info("------------------------------------------------------");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 访问首页提示
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @return /
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @GetMapping("/")
 | 
				
			||||||
 | 
					    public String index() {
 | 
				
			||||||
 | 
					        return String.format("%s backend service started successfully.", env.getProperty("continew-admin.name"));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										5
									
								
								src/main/resources/application-dev.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/main/resources/application-dev.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					--- ### 服务器配置
 | 
				
			||||||
 | 
					server:
 | 
				
			||||||
 | 
					  # HTTP 端口(默认 8080)
 | 
				
			||||||
 | 
					  port: 8000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										5
									
								
								src/main/resources/application-prod.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/main/resources/application-prod.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					--- ### 服务器配置
 | 
				
			||||||
 | 
					server:
 | 
				
			||||||
 | 
					  # HTTP 端口(默认 8080)
 | 
				
			||||||
 | 
					  port: 18000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										48
									
								
								src/main/resources/application.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								src/main/resources/application.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,48 @@
 | 
				
			|||||||
 | 
					--- ### 项目配置
 | 
				
			||||||
 | 
					continew-admin:
 | 
				
			||||||
 | 
					  # 名称
 | 
				
			||||||
 | 
					  name: ContiNew-Admin
 | 
				
			||||||
 | 
					  # 应用名称
 | 
				
			||||||
 | 
					  appName: @project.name@
 | 
				
			||||||
 | 
					  # 版本
 | 
				
			||||||
 | 
					  version: @project.version@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- ### 日志配置
 | 
				
			||||||
 | 
					logging:
 | 
				
			||||||
 | 
					  level:
 | 
				
			||||||
 | 
					    top.charles7c: @logging.level@
 | 
				
			||||||
 | 
					  file:
 | 
				
			||||||
 | 
					    path: @logging.file.path@
 | 
				
			||||||
 | 
					  config: classpath:logback-spring.xml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- ### 服务器配置
 | 
				
			||||||
 | 
					server:
 | 
				
			||||||
 | 
					  servlet:
 | 
				
			||||||
 | 
					    # 应用访问路径
 | 
				
			||||||
 | 
					    context-path: /
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					--- ### Spring 配置
 | 
				
			||||||
 | 
					spring:
 | 
				
			||||||
 | 
					  application:
 | 
				
			||||||
 | 
					    name: ${continew-admin.appName}
 | 
				
			||||||
 | 
					  ## 环境配置
 | 
				
			||||||
 | 
					  profiles:
 | 
				
			||||||
 | 
					    # 启用的环境
 | 
				
			||||||
 | 
					    # 配合 Maven Profile 选择不同配置文件进行启动,在 IntelliJ IDEA 右侧 Maven 工具窗口可以快速切换环境
 | 
				
			||||||
 | 
					    active: @profiles.active@
 | 
				
			||||||
 | 
					  ## JSON 配置
 | 
				
			||||||
 | 
					  jackson:
 | 
				
			||||||
 | 
					    # 时区配置
 | 
				
			||||||
 | 
					    time-zone: GMT+8
 | 
				
			||||||
 | 
					    # 日期格式化
 | 
				
			||||||
 | 
					    date-format: yyyy-MM-dd HH:mm:ss
 | 
				
			||||||
 | 
					    # 序列化配置(Bean -> JSON)
 | 
				
			||||||
 | 
					    serialization:
 | 
				
			||||||
 | 
					      # 是否格式化输出
 | 
				
			||||||
 | 
					      indent_output: false
 | 
				
			||||||
 | 
					      # 忽略无法转换的对象
 | 
				
			||||||
 | 
					      fail_on_empty_beans: false
 | 
				
			||||||
 | 
					    # 反序列化配置(JSON -> Bean)
 | 
				
			||||||
 | 
					    deserialization:
 | 
				
			||||||
 | 
					      # 忽略 JSON 中不存在的属性
 | 
				
			||||||
 | 
					      fail_on_unknown_properties: false
 | 
				
			||||||
							
								
								
									
										8
									
								
								src/main/resources/banner.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/main/resources/banner.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
				
			|||||||
 | 
					   ____               _    _  _   _                          _        _             _
 | 
				
			||||||
 | 
					  / ___| ___   _ __  | |_ (_)| \ | |  ___ __      __        / \    __| | _ __ ___  (_) _ __
 | 
				
			||||||
 | 
					 | |    / _ \ | '_ \ | __|| ||  \| | / _ \\ \ /\ / /_____  / _ \  / _` || '_ ` _ \ | || '_ \
 | 
				
			||||||
 | 
					 | |___| (_) || | | || |_ | || |\  ||  __/ \ V  V /|_____|/ ___ \| (_| || | | | | || || | | |
 | 
				
			||||||
 | 
					  \____|\___/ |_| |_| \__||_||_| \_| \___|  \_/\_/       /_/   \_\\__,_||_| |_| |_||_||_| |_|
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 :: ${continew-admin.name} ::                                               v${continew-admin.version}
 | 
				
			||||||
 | 
					 :: Spring Boot    ::                                               v${spring-boot.version}
 | 
				
			||||||
							
								
								
									
										69
									
								
								src/main/resources/logback-spring.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										69
									
								
								src/main/resources/logback-spring.xml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,69 @@
 | 
				
			|||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<!-- 日志级别从低到高分为 TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为 WARN,则低于 WARN 的信息都不会输出 -->
 | 
				
			||||||
 | 
					<!-- scan:当此属性设置为 true 时,配置文档如果发生改变,将会被重新加载,默认值为 true -->
 | 
				
			||||||
 | 
					<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。
 | 
				
			||||||
 | 
					       当 scan 为 true 时,此属性生效。默认的时间间隔为 1 分钟。 -->
 | 
				
			||||||
 | 
					<!-- debug:当此属性设置为 true 时,将打印出 logback 内部日志信息,实时查看 logback 运行状态。默认值为 false。 -->
 | 
				
			||||||
 | 
					<configuration debug="false" scan="true" scanPeriod="30 seconds">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- 应用名 -->
 | 
				
			||||||
 | 
					    <springProperty name="APP_NAME" source="spring.application.name" scope="context" />
 | 
				
			||||||
 | 
					    <!-- 保存路径 -->
 | 
				
			||||||
 | 
					    <property name="LOG_PATH" value="${LOG_PATH:-./logs}" />
 | 
				
			||||||
 | 
					    <!-- 字符集 -->
 | 
				
			||||||
 | 
					    <property name="LOG_CHARSET" value="utf-8" />
 | 
				
			||||||
 | 
					    <!-- 控制台输出格式(带颜色) -->
 | 
				
			||||||
 | 
					    <!-- 格式化输出:%d 表示日期;%thread 表示线程名;%-5level:级别从左显示 5 个字符宽度;%msg:日志消息;%n 是换行符 -->
 | 
				
			||||||
 | 
					    <property name="CONSOLE_LOG_PATTERN" value="%red(%d{yyyy-MM-dd HH:mm:ss}) %highlight(%-5level) %green([%thread]) %boldMagenta(%logger{50}) - %msg%n" />
 | 
				
			||||||
 | 
					    <!-- 文件输出格式 -->
 | 
				
			||||||
 | 
					    <property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread] %logger{50} - %msg%n"/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- 输出日志到控制台 -->
 | 
				
			||||||
 | 
					    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
 | 
				
			||||||
 | 
					        <encoder>
 | 
				
			||||||
 | 
					            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
 | 
				
			||||||
 | 
					            <charset>${LOG_CHARSET}</charset>
 | 
				
			||||||
 | 
					        </encoder>
 | 
				
			||||||
 | 
					    </appender>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- 输出日志到文件 -->
 | 
				
			||||||
 | 
					    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
 | 
				
			||||||
 | 
					        <encoder>
 | 
				
			||||||
 | 
					            <pattern>${FILE_LOG_PATTERN}</pattern>
 | 
				
			||||||
 | 
					            <charset>${LOG_CHARSET}</charset>
 | 
				
			||||||
 | 
					        </encoder>
 | 
				
			||||||
 | 
					        <!-- 循环政策:基于时间和大小创建日志文件 -->
 | 
				
			||||||
 | 
					        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
 | 
				
			||||||
 | 
					            <!-- 日志文件输出的文件名 -->
 | 
				
			||||||
 | 
					            <fileNamePattern>${LOG_PATH}/%d{yyyy-MM-dd, aux}/${APP_NAME}.%d{yyyy-MM-dd_HH}.%i.log</fileNamePattern>
 | 
				
			||||||
 | 
					            <!-- 日志保存 10 天(一小时生成一个,一天 24 个文件) -->
 | 
				
			||||||
 | 
					            <maxHistory>240</maxHistory>
 | 
				
			||||||
 | 
					            <!-- 单个日志文件最大的大小 -->
 | 
				
			||||||
 | 
					            <maxFileSize>20MB</maxFileSize>
 | 
				
			||||||
 | 
					        </rollingPolicy>
 | 
				
			||||||
 | 
					    </appender>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- 异步输出日志到文件 -->
 | 
				
			||||||
 | 
					    <appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
 | 
				
			||||||
 | 
					        <!-- 不丢失日志,默认:如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 -->
 | 
				
			||||||
 | 
					        <discardingThreshold>0</discardingThreshold>
 | 
				
			||||||
 | 
					        <!-- 更改默认的队列的深度,该值会影响性能,默认:256 -->
 | 
				
			||||||
 | 
					        <queueSize>512</queueSize>
 | 
				
			||||||
 | 
					        <!-- 添加附加的 appender,最多只能添加一个 -->
 | 
				
			||||||
 | 
					        <appender-ref ref="FILE"/>
 | 
				
			||||||
 | 
					    </appender>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- 开发环境:只打印到控制台 -->
 | 
				
			||||||
 | 
					    <springProfile name="dev">
 | 
				
			||||||
 | 
					        <root level="INFO">
 | 
				
			||||||
 | 
					            <appender-ref ref="CONSOLE"/>
 | 
				
			||||||
 | 
					        </root>
 | 
				
			||||||
 | 
					    </springProfile>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <!-- 生产环境:只输出到文件 -->
 | 
				
			||||||
 | 
					    <springProfile name="prod">
 | 
				
			||||||
 | 
					        <root level="INFO">
 | 
				
			||||||
 | 
					            <appender-ref ref="ASYNC_FILE"/>
 | 
				
			||||||
 | 
					        </root>
 | 
				
			||||||
 | 
					    </springProfile>
 | 
				
			||||||
 | 
					</configuration>
 | 
				
			||||||
@@ -0,0 +1,13 @@
 | 
				
			|||||||
 | 
					package top.charles7c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.junit.jupiter.api.Test;
 | 
				
			||||||
 | 
					import org.springframework.boot.test.context.SpringBootTest;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@SpringBootTest
 | 
				
			||||||
 | 
					class ContinewAdminApplicationTests {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Test
 | 
				
			||||||
 | 
					    void contextLoads() {
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user