杭州互联网企业建站时必须满足哪些条件?
摘要:杭州互联网网站公司,做网站的必要条件,音视频网站建设可行性报告,包头seo哪家专业自动装配 1、pom.xml spring-boot-dependencies:核心依赖在父工程中&#xff01
杭州互联网网站公司,做网站的必要条件,音视频网站建设可行性报告,包头seo哪家专业自动装配
1、pom.xml
spring-boot-dependencies#xff1a;核心依赖在父工程中#xff01;我们在写或者引入一些SpringBoot依赖的时候#xff0c;不需要指定版本#xff0c;就因为有这些版本仓库
1.1 其中它主要是依赖一个父工程#xff0c;作用是管理项目的资源过滤及…自动装配
1、pom.xml
spring-boot-dependencies核心依赖在父工程中我们在写或者引入一些SpringBoot依赖的时候不需要指定版本就因为有这些版本仓库
1.1 其中它主要是依赖一个父工程作用是管理项目的资源过滤及插件
parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion2.6.5/versionrelativePath/ !-- lookup parent from repository --
/parent1.2 点进去发现还有一个父依赖
parentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-dependencies/artifactIdversion2.6.5/version
/parent1.3 这里才是真正管理SpringBoot应用里面所有依赖版本的地方SpringBoot的版本控制中心
1.4 以后我们导入依赖默认是不需要写版本但是如果导入的包没有在依赖中管理着就需要手动配置版本了
2、启动器 spring-boot-starter 依赖 dependency groupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter/artifactId
/dependencyspringboot-boot-starter-xxx说白了就是Springboot的启动场景 比如spring-boot-starter-web他就会帮我们自动导入web的所有依赖 springboot会将所有的功能场景都变成一个个的启动器 我们要使用什么功能就只需要找到对应的启动器start就好了
3、主程序
3.1、默认的主启动类
//SpringBootApplication 来标注一个主程序类,说明这是一个Spring Boot应用
SpringBootApplication
public class SpringbootApplication {public static void main(String[] args) {//以为是启动了一个方法没想到启动了一个服务SpringApplication.run(SpringbootApplication.class, args);}
}但是一个简单的启动类并不简单我们来分析一下这些注解都干了什么 3.2、注解SpringBootApplication 作用标注在某个类上说明这个类是SpringBoot的主配置类 SpringBoot就应该运行这个类的main方法来启动SpringBoot应用 进入这个注解可以看到上面还有很多其他注解 SpringBootConfiguration
EnableAutoConfiguration
ComponentScan(excludeFilters {Filter(type FilterType.CUSTOM,classes {TypeExcludeFilter.class}
), Filter(type FilterType.CUSTOM,classes {AutoConfigurationExcludeFilter.class}
)}
)
public interface SpringBootApplication {// ......
}ComponentScan 这个注解在Spring中很重要 ,它对应XML配置中的元素。
