小编Jua*_*nao的帖子

如何使用spring boot更改embebed-tomcat默认端口?

我正在使用带有maven的spring-boot,这是我的配置类:

package hello;

import javax.servlet.MultipartConfigElement;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

应用程序启动时在控制台中显示此行:

2014-11-06 17:00:55.102  INFO 4669 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
Run Code Online (Sandbox Code Playgroud)

我想将TomcatEmbedded端口更改为8081.感谢:D

java tomcat spring-boot

10
推荐指数
2
解决办法
3万
查看次数

标签 统计

java ×1

spring-boot ×1

tomcat ×1