3. spring boot 1.5.4 web Container customization (port number and other modifications), spring1.5.4
By default, spring boot uses tomcat as the Embedded web container.
There are three customization methods
.
@ Componentpublic class CustomizationBean implements customization {/*** custom Method 1: Implement customization * @ param container */@ Override public void customize (ConfigurableEmbeddedServletContainer container) {// container. setPort (9000);}/*** custom Method 2: inject EmbeddedServletContainerFactory * @ return */@ Bean public EmbeddedServletContainerFactory servletContainer () {login factory = new Login (); factory. setPort (9001); factory. setSessionTimeout (10, TimeUnit. MINUTES); // The priority is higher than the 404.html page factory configured in the/static/errorfolder. addErrorPages (new ErrorPage (HttpStatus. NOT_FOUND, "/error/403.html"); return factory ;}}
3. Add the following configurations to the configuration file:
#=====================servlet container config==================server.port=8080server.ssl.enabled=falseserver.address=127.0.0.1server.session.persistent=true#1800 seconds,30 minutesserver.session.timeout=1800server.session.store-dir=/Users/hdwang/sessiontmp