Springboot Tomcat Launcher

Source: Internet
Author: User
Tags xmlns tomcat
application Configuration Class:
@SpringBootApplication public
class Servletinitializer extends Springbootservletinitializer {
    @Override
    protected Springapplicationbuilder Configure (Springapplicationbuilder application) {
        return Application.sources (Servletinitializer.class);
    }

    public static void Main (string[] args) throws Exception {
        springapplication.run (servletinitializer.class, args);
    }

}

Note : The startup class is best placed in the outermost layer of the project's package, so that you can scan to all package paths.

Controller:

@Controller public
class Bootcontroller {
    @RequestMapping ("/")
    @ResponseBody
    String Home () {
        return "Hello world!";
    }
    public static void Main (string[] args) throws Exception {
        springapplication.run (bootcontroller.class, args);
    }
}

Pom

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi:s chemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" > < Modelversion>4.0.0</modelversion> <groupId>cn.creditease.springboot</groupId> < Artifactid>springboot</artifactid> <packaging>war</packaging> <version>1.0</ version> <name>maven webapp</name> <url>http://maven.apache.org</url> <propertie S> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project_charset> Utf-8</project_charset> <maven.compiler.source>1.7</maven.compiler.source> < Maven.compiler.target>1.7</maven.compiler.target> <tomcat.version>7.0.67</tomcat.version> & Lt;/properties> <parent> <groupid>org.springframework.booT</groupid> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.1.rel ease</version> </parent> <dependencies> <dependency> <groupid>or G.springframework.boot</groupid> <artifactId>spring-boot-starter-web</artifactId> &L
            T;/dependency> <dependency> <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope>
            </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> &L t;/dependency> </dependencies> <repositories> <repository> <i d>spring-releases</id> <name>spring releases</name> <url>http://repo.spring.io/libs-rel
                Ease-local</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </project>

Note: If you want to start with TOMCAT7, you need to develop your Tomcat version number.

Server:
  port:8080
  spring.mvc.view.prefix:/web-inf/jsp/
  spring.mvc.view.suffix:. jsp

Project

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.