筆記三 SpringBoot原理分析

2021-10-01 05:29:00 字數 1427 閱讀 9608

三、springboot原理分析

3.1 起步依賴原理分析

按住command檢視spring-boot-starter-parent深層xml重點配置

org.springframework.boot

spring-boot-dependencies

2.0.1.release

../../spring-boot-dependencies

按住command檢視spring-boot-dependencies深層xml重點配置

5.15.3

2.7.7

2.4.0

1.8.13

3.9.1

4.0.6

2.1.4

3.2 自動配置原理解析

package com.itheima;

//宣告該類是乙個springboot引導類

public static void main(string args)

}

@target()

@retention(retentionpolicy.runtime)

@documented

@inherited

@springbootconfiguration

@enableautoconfiguration

@componentscan(

excludefilters =

), @filter(

type = filtertype.custom,

classes = )})

@aliasfor(

annotation = enableautoconfiguration.class

)class<?> exclude() default {};

@aliasfor(

annotation = enableautoconfiguration.class

)string excludename() default {};

@aliasfor(

annotation = componentscan.class,

attribute = "basepackages"

)string scanbasepackages() default {};

@aliasfor(

annotation = componentscan.class,

attribute = "basepackageclasses"

)class<?> scanbasepackageclasses() default {};

}

SpringBoot 筆記 自動裝配原理

springboot 為我們封裝了大量的xml配置,使得我們構建web程式可以實現開箱即用 pom.xml springboot將所有的功能都變成了乙個個的啟動器 pom.xml org.springframework.bootgroupid spring boot starter webartif...

Spring boot 學習筆記(三)

一.bean的scope scope描述的是spring容器如何新建bean的市裡的。spring的scope有以下幾種,通過 scope註解來實現。1 singleton 乙個spring容器中只有乙個bean的例項,為此spring的預設配置,全容器 共享乙個例項。2 prototype 每次呼...

SpringBoot學習筆記(三)

restcontroller 註解,對具有返回型別的controller類使用。相當於 responsebody controller。使用 restcontroller的目的在於使用傳統方法是返回資料格式都為json,需要使用 responsebody註解,但是 restcontroller修飾的...