记录学习springboot各个记录,知识点
springboot 选包方式一定为Jar包方式, 因为它最终是java程序进行执行
springboot 原理: 1.springMVC注解启动 2.内置tomcat 3.maven依赖继承
JDK版本一定要是1.8以上,因为springboot是依赖jdk1.8开发
添加依赖: 原理maven依赖传递
<!--父工程-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency> <!--整合web组件,整合springMvc-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
spring boot 启动的两种方式:
1. @ComponentScan(basePackages = "com.itmayiedu.controller") //扫包
@EnableAutoConfiguration
2.@SpringBootApplication //等同于@EnableAutoConfiguration+@ComponentScan
//自动扫包 .扫包范围 :当前包下或者子包下所有的类都可以扫到