How do I configure this property with Spring Boot and an embedded Tomcat?

前端 未结 4 453
清酒与你
清酒与你 2020-12-09 06:17

Do I configure properties like the connectionTimeout in the application.properties file or is the somewhere else to do it? I can\'t figure this out from Google.

Tomc

4条回答
  •  北海茫月
    2020-12-09 06:35

    I prefer set of system properties before the server start:

    /**
     * Start SpringBoot server
     */
    @SpringBootApplication(scanBasePackages= {"com.your.conf.package"})
    //@ComponentScan(basePackages = "com.your.conf.package")
    public class Application {
        public static void main(String[] args) throws Exception {
            System.setProperty("server.port","8132"));
            System.setProperty("server.tomcat.max-threads","200");
            System.setProperty("server.connection-timeout","60000");
            ApplicationContext ctx = SpringApplication.run(Application.class, args);
        }
    }
    

提交回复
热议问题