У нас вы можете посмотреть бесплатно What happens when a Spring Booot Start up ? | Internal Flow of Spring boot project | Part 4 или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
In this session - we will discuss the internal flow of spring boot - what happens when a spring Boot Starts up. How does internally this work? Spring does not generate any code automatically and not using any xml configuration file . spring uses internally pragmatically configuration done by spring boot developer that are provided by jar. we are using just pre-configured jar . and those jar available in: META-INF/spring.factories To Enable preconfigured jars we just need to define dependency in pom.xml file. This dependency will load all the jars related to JPA repository and stored into spring.factories. you can go to maven dependencies then click and open spring-boot-autoconfigure jar in the last you will see META-INF folder inside this spring.factories here you will find your jar org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration. Based on @Conditional and @Configuration : @ConditionalOnBean(DataSource.class) : It will serach for the DataSource bean if it is available then only it will enable JpaRepositoriesAutoConfiguration . So this we need to define DataSource related properties into our property file. @ConditionalOnClass(JpaRepository.class) : It will serach for the JpaRepository class if it is available then only it will enable JpaRepositoriesAutoConfiguration . If all conditions are true then only it will enable JpaRepositoriesAutoConfiguration class. If all the conditions are satisfied then only spring will enable to the component. Summary:- When Spring Boot boots up: It tries to read in .properties from 17 hard-coded locations. It also reads in the spring.factories file of your autoconfigure-module and finds out which AutoConfigurations it should evaluate. It has an enhanced concept of @Conditionals, compared to plain Spring. Now it turn to Analyze the Tomcat AutoConfiguration How can Spring Boot boot up an embedded Tomcat server by default? It needs to check if Tomcat is on the classpath. (@ConditionalOnClass(Tomcat.class)) It might take into account specific properties that the user sets, like server.port. It needs to take Spring WebMVC’s DispatcherServlet and register it with Tomcat, to make your @RestControllers with their @GetMappings and @PostMappings work. It needs to start your embedded Tomcat server (and therefore your DispatcherServlet). Basically, spring boot supports three embedded servers:- Tomcat (default), Jetty and Undertow. High Level Flow Of Spring Boot And How run Method works : From the run method, the main application context is kicked off - which in turn searches for the classes annotated with @Configuration, initializes all the declared beans in those configuration classes, and based upon the scope of those beans, stores those beans in JVM, specifically in a space inside JVM which is known as IOC container. After the creation of all the beans, automatically configures the dispatcher servlet and registers the default handler mappings, messageConverts, and all other basic things. What is the internal flow of run() : Create application context Check Application Type Register the annotated class beans with the context Creates an instance of TomcatEmbeddedServletContainer : and adds the context. Used to deploy our jar automatically. #springboot #spring