3. spring boot 1.5.4 web Container customization (port number and other modifications), spring1.5.4

Source: Internet
Author: User

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= seconds,30 minutesserver.session.timeout=1800server.session.store-dir=/Users/hdwang/sessiontmp


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.