springboot优点:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>


<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

双击package,打包,会在下面生成一个目录,里面是一个jar,可以拖到桌面,命令行执行jar,也可以运行
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
</parent>
他的父项目:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath>../../spring-boot-dependencies</relativePath>
</parent>
他真正管理springboot应用里面的所有依赖版本
springBoot的版本仲裁中心;以后我们导入依赖默认是不需要写版本;(没有在dependencies里面管理的依赖自然要声明版本号)
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
spring-boot-starter-web
spring-boot-starter:spring-boot场景启动器;帮我们导入web模块正常运行所依赖的组件;
/**
* @SpringBootApplication来标注一个主程序,说明这是一个springboot应用
*/
@SpringBootApplication
public class HelloWorldMainApplication {
public static void main(String[] args) {
//spring应用启动起来
SpringApplication.run(HelloWorldMainApplication.class,args);
}
}
@SpringBootApplication springboot应用标注在某个类上,说明这个类是springboot的主配置类,springboot就应该运行这个类的main方法来启动springboot应用;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan(
excludeFilters = {@Filter(
type = FilterType.CUSTOM,
classes = {TypeExcludeFilter.class}
), @Filter(
type = FilterType.CUSTOM,
classes = {AutoConfigurationExcludeFilter.class}
)}
)
@SpringBootConfiguration springboot的配置类 标注在某个类上,表示这是一个springboot的配置类
@EnableAutoConfiguration :开启自动配置功能; 以前需要配置的东西,springboot帮我们配置,
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@AutoConfigurationPackage
@Import({EnableAutoConfigurationImportSelector.class})
@AutoConfigurationPackage 自动配置包
@Import({EnableAutoConfigurationImportSelector.class}) ---springboot底层注解,给容器中导入一个组件,由括号里决定导入什么,, 将主配置类所在包以及子包扫码到spring容器原文:https://www.cnblogs.com/gagaAurora/p/14003921.html