标签:relative main方法 inf boot 默认 包含 color auto 日志
基于Spring Boot创建的maven项目

1、application.properties或者application.yml:全局配置文件
作用:主要用来配置数据库连接、日志相关配置等
推荐使用yml


2、DemoApplication.javamain方法:应用入口
@SpringBootApplication:核心注解,主要目的是开启自动配置
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
3、pom.xml
Spring boot的项目必须要将parent设置为spring boot的parent,该parent包含了大量默认的配置。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Spring Boot的web支持
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Spring Boot的测试
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
Spring Boot的maven插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
4、静态资源访问
目录名需符合如下规则:
标签:relative main方法 inf boot 默认 包含 color auto 日志
原文地址:http://www.cnblogs.com/tianzhebuzhu/p/7617049.html