springboot的四大组件是什么?
互联网
20-11-18
springboot的四大组件为:1、auto-configuration组件;2、starter组件;3、springboot cli组件;4、actuator组件。

Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。通过这种方式,Spring Boot致力于在蓬勃发展的快速应用开发领域(rapid application development)成为领导者。

springboot的四大组件
auto-configuration:
starter:
springboot cli
Spring Boot CLI(Command Line Interface)是一个命令行工具,您可以用它来快速构建Spring原型应用。通过Spring Boot CLI,我们可以通过编写Groovy脚本来快速的构建出Spring Boot应用,并通过命令行的方式将其运行起来。
actuator









package com.gufang.annotation; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Enable Gufang DevTool for spring boot application * * @author chen.qixiang * @version 1.0.0 * @since 1.0.0 */ @Target({ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) @Documented public @interface EnableGufangConfiguration { }

package com.gufang.boot; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.gufang.annotation.EnableGufangConfiguration; @Configuration @ConditionalOnBean(annotation = EnableGufangConfiguration.class) @EnableConfigurationProperties(GufangProperties.class) public class GufangConfiguration { @Autowired private GufangProperties properties; @Bean public Object createBean() { System.out.println("Gufang="+properties); return new Object(); } }
package com.gufang.boot.context.event; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; import org.springframework.context.ApplicationListener; import com.gufang.annotation.EnableGufangConfiguration; public class GufangBannerApplicationListener implements ApplicationListener<ApplicationEnvironmentPreparedEvent> { public static String gufangLogo = " ###################################################################################### \n" + " ######## # # ######## \n" + " ######## ######## ######### ### # # #### ##### ##### ######## \n" + " ######## # # # # # ## # # # ######## \n" + " ######## ##### ###### # # # # # # ##### ##### ######## \n" + " ######## # # # # # # # # # # # # ######## \n" + " ######## ##### # # # # # # # #### ##### # # ######## \n" + " ###################################################################################### \n" + " \n" + "\n"; public static String LINE_SEPARATOR = System.getProperty("line.separator"); @Override public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { System.out.println(buildBannerText()); } private String buildBannerText() { StringBuilder bannerTextBuilder = new StringBuilder(); bannerTextBuilder.append(LINE_SEPARATOR).append(gufangLogo).append(" :: Gufang :: (v1.0.0)") .append(LINE_SEPARATOR); return bannerTextBuilder.toString(); } }
spring.factories
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.gufang.boot.GufangConfiguration org.springframework.context.ApplicationListener=\ com.gufang.boot.context.event.GufangBannerApplicationListener
spring.provides
provides: gufang-spring-boot-starter




















更多编程相关知识,请访问:编程视频!!
以上就是springboot的四大组件是什么?的详细内容,更多内容请关注技术你好其它相关文章!
免责声明:
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表本站的观点或立场
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表本站的观点或立场