An overview of the

SpringBoot is what?

  • Originally a lightweight IOC container, it was expanded to include technologies such as secure data integration

SpringBoot core functions

  • SpringBoot is started as a Jar package. The reason why SpringBoot can run independently as a Jar package is that the Servlet container is embedded in the Jar package.

    SpringBoot can be embedded with Tomcat and Jet. Jar packages need only rely on JDK dependencies to start. Provides Starter to simplify configuration, Starter

    Starter is a Maven configuration. Starter is a Maven configuration.

SpringBoot advantages

  • Build projects quickly and integrate mainstream frameworks quickly without configuration
  • Projects can also independently run Tomcat, an out-of-order externally dependent Servlet container
  • Natural integration with cloud computing SpringBoot can run independently as a Jar package, providing a microservice implementation standard

Different from SpringMVC development

Configuration of POM

SpringBoot program entry

SpringBoot provides maven plug-ins

Add OPERATION and maintenance monitoring Actuator

O&m monitoring information

Spring Boot2.0 starts dependencies and autowiring

SpringBoot starts the dependency

SpringBoot core API

  • SpringBootConfiguration supports Java configuration classes
  • EnableAutoConfiguration Enables the automatic assembly function
  • ComponentScan scans Bean components
Automatic assembly AutoConfigurationImportSelector

The name of the returned String[] array is loaded as a Bean

@Override
	public String[] selectImports(AnnotationMetadata annotationMetadata) {
		if(! isEnabled(annotationMetadata)) {return NO_IMPORTS;
		}
		AutoConfigurationMetadata autoConfigurationMetadata = AutoConfigurationMetadataLoader
				.loadMetadata(this.beanClassLoader);
		AnnotationAttributes attributes = getAttributes(annotationMetadata);
		List<String> configurations = getCandidateConfigurations(annotationMetadata,
				attributes);
		configurations = removeDuplicates(configurations);
		Set<String> exclusions = getExclusions(annotationMetadata, attributes);
		checkExcludedClasses(configurations, exclusions);
		configurations.removeAll(exclusions);
		configurations = filter(configurations, autoConfigurationMetadata);
		fireAutoConfigurationImportEvents(configurations, exclusions);
		return StringUtils.toStringArray(configurations);
	}
Copy the code
	protected List<String> getCandidateConfigurations(AnnotationMetadata metadata, AnnotationAttributes attributes) {
		List<String> configurations = SpringFactoriesLoader.loadFactoryNames(
				getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader());
		Assert.notEmpty(configurations,
				"No auto configuration classes found in META-INF/spring.factories. If you "
						+ "are using a custom packaging, make sure that file is correct.");
		return configurations;
	}
Copy the code
  • Load the spring.factories configuration file

    Specific Bean

The commonly used AutoConfiguration

ConditionalXXX

Activiti6.0 integrates with Spring Boot2.0

Upgrade Activiti6.0 to rely on SpringBoot version 2.0