如何使用弹簧启动更改 embebed-tomcat 默认端口?
2022-09-05 00:16:45
我正在使用带有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);
}
}
当应用启动时,在控制台中显示以下行:
2014-11-06 17:00:55.102 INFO 4669 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
我想将TomcatEmbedded端口更改为8081。谢谢:D