Browse Source

commit 1

master
jshixiong 1 year ago
parent
commit
761885626c
7 changed files with 174 additions and 0 deletions
  1. +5
    -0
      .gitignore
  2. +58
    -0
      pom.xml
  3. +13
    -0
      src/main/java/com/example/test/jsxtestttt/JsxtesttttApplication.java
  4. +24
    -0
      src/main/java/com/example/test/jsxtestttt/controller/HelloController.java
  5. +2
    -0
      src/main/resources/application.properties
  6. +59
    -0
      src/main/resources/logback-spring.xml
  7. +13
    -0
      src/test/java/com/example/test/jsxtestttt/JsxtesttttApplicationTests.java

+ 5
- 0
.gitignore View File

@@ -19,7 +19,12 @@
*.zip
*.tar.gz
*.rar
*.iml

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.idea
.vscode
target/


+ 58
- 0
pom.xml View File

@@ -0,0 +1,58 @@
<?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.0.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>jsxtestttt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>jsxtestttt</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

</project>

+ 13
- 0
src/main/java/com/example/test/jsxtestttt/JsxtesttttApplication.java View File

@@ -0,0 +1,13 @@
package com.example.test.jsxtestttt;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class JsxtesttttApplication {

public static void main(String[] args) {
SpringApplication.run(JsxtesttttApplication.class, args);
}

}

+ 24
- 0
src/main/java/com/example/test/jsxtestttt/controller/HelloController.java View File

@@ -0,0 +1,24 @@
package com.example.test.jsxtestttt.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

private final Logger logger = LoggerFactory.getLogger(HelloController.class);

@GetMapping("/")
public String index() {
logger.info("a log : web greetings from Spring Boot");
return "Greetings from Spring Boot!";
}
@GetMapping("/healthcheck")
public String healthcheck() {
return "Greetings from Spring Boot!";
}

}


+ 2
- 0
src/main/resources/application.properties View File

@@ -0,0 +1,2 @@
server.port=8881
logging.config=classpath:logback-spring.xml

+ 59
- 0
src/main/resources/logback-spring.xml View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- <springProperty scope="context" name="logPath" source="log.path"/>-->
<property name="logPattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger-%msg%n"/>

<!-- 标准输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${logPattern}</pattern>
</encoder>
<!-- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">&ndash;&gt;-->
<!-- <fileNamePattern>logs/jsxdemo.%d{yyyy-MM-dd}.log</fileNamePattern>-->
<!-- <maxHistory>7</maxHistory>-->
<!-- </rollingPolicy>-->
</appender>

<!-- 日志按天生成 -->
<!-- <appender name="bridge" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
<!-- <encoder>-->
<!-- <pattern>${logPattern}</pattern>-->
<!-- </encoder>-->
<!-- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
<!-- <fileNamePattern>logs/bridge.%d{yyyy-MM-dd}.log</fileNamePattern>-->
<!-- <maxHistory>7</maxHistory>-->
<!-- </rollingPolicy>-->
<!-- </appender>-->

<!-- 错误日志单独再记录,以便当前的日志分析报警 -->
<!-- <appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">-->
<!-- <level>ERROR</level>-->
<!-- </filter>-->
<!-- <encoder>-->
<!-- <pattern>${logPattern}</pattern>-->
<!-- </encoder>-->
<!-- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
<!-- <fileNamePattern>${logPath}/error.%d{yyyy-MM-dd}.log</fileNamePattern>-->
<!-- <maxHistory>7</maxHistory>-->
<!-- </rollingPolicy>-->
<!-- </appender>-->

<!-- 屏蔽框架输出 -->
<!-- <logger name="io.swagger" level="ERROR"/>-->
<!-- <logger name="ch.qos.logback" level="OFF"/>-->
<!-- <logger name="com.spotify.docker.client" level="ERROR"/>-->
<!-- <logger name="org.apache.ibatis" level="INFO"/>-->
<!-- <logger name="tk.mybatis.mapper" level="INFO"/>-->
<!-- <logger name="org.mybatis.spring" level="INFO"/>-->
<!-- <logger name="com.educoder.bridge.sys.dao" level="INFO"/>-->
<!-- <logger name="com.educoder.bridge.k8s.dao" level="INFO"/>-->

<root>
<level value="INFO"/>
<!-- <appender-ref ref="bridge"/>-->
<!-- <appender-ref ref="error"/>-->
<appender-ref ref="STDOUT"/>
</root>

</configuration>

+ 13
- 0
src/test/java/com/example/test/jsxtestttt/JsxtesttttApplicationTests.java View File

@@ -0,0 +1,13 @@
package com.example.test.jsxtestttt;

import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class JsxtesttttApplicationTests {

@Test
void contextLoads() {
}

}

Loading…
Cancel
Save