pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.project.test</groupId>
<artifactId>springboot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<!--web.xml文件可以缺失 -->
<failOnMissingWebXml>false</failOnMissingWebXml>
<!--编码格式 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!--jdk版本 -->
<java.version>1.8</java.version>
</properties>
<!-- 父模块、引入springboot的基本依赖文件,springboot的基本包都在父模块中,列如tomcat插件、其他的jar -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
<dependencies>
<!-- 引入springboot的web模块 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- springboot jsp模块解析 -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
aciton文件配置:
package com.project.action;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
*
* @author Administrator
*
*/
@Controller
@SpringBootApplication
public class LoginAction {
@RequestMapping("/login.action")
public String login() {
System.out.println("测试springBoot");
return "index.jsp";
}
/**
* 运行springboot程序
* @param args
*/
public static void main(String[] args) {
SpringApplication.run(LoginAction.class, args);
}
}