Skip to content

Commit

Permalink
Spring Boot 2.x 配置 undertow 容器
Browse files Browse the repository at this point in the history
  • Loading branch information
weiwosuoai committed Feb 22, 2019
1 parent d094048 commit fe12c52
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 0 deletions.
54 changes: 54 additions & 0 deletions spring-boot-undertow/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?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 http://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.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>site.exception</groupId>
<artifactId>spring-boot-undertow</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-boot-undertow</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-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package site.exception.springbootundertow;

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

@SpringBootApplication
public class SpringBootUndertowApplication {

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

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package site.exception.springbootundertow.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @author jiangbing(江冰)
* @date 2019/2/22
* @time 20:20
* @discription
**/
@RestController
public class TestController {

@GetMapping("/test")
public String test() {
return "success !";
}
}
10 changes: 10 additions & 0 deletions spring-boot-undertow/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 是否打开 undertow 日志,默认为 false
server.undertow.accesslog.enabled=false
# 设置访问日志所在目录
server.undertow.accesslog.dir=logs
# 指定工作者线程的 I/0 线程数,默认为 2 或者 CPU 的个数
server.undertow.io-threads=
# 指定工作者线程个数,默认为 I/O 线程个数的 8 倍
server.undertow.worker-threads=
# 设置 HTTP POST 内容的最大长度,默认不做限制
server.undertow.max-http-post-size=0
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package site.exception.springbootundertow;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class SpringBootUndertowApplicationTests {

@Test
public void contextLoads() {
}

}

0 comments on commit fe12c52

Please sign in to comment.