7.spring-boot依赖详解

有品
2023-12-01
spring-boot
1.初始
基础
    spring-jcl
    spring-core
    spring-beans
    spring-context
    spring-aop
    ....
web模块
    spring-web
    spring-webmvc
数据库
    mysql-connection-java-8.0.11
mybatis模块
    mybatis-3.4.0
    mybatis-spring-1.3.0


2.spring-boot.jar-> spring-boot-parent.pom
	<dependencies>
		<!-- Compile -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
		</dependency>
		<!-- Optional -->
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<optional>true</optional>
		</dependency>
        ......
    </dependencies>

3.1 spring-boot-starter.jar基础-> spring-boot-starters.pom
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-autoconfigure</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-logging</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<exclusions>
				<exclusion>
					<groupId>commons-logging</groupId>
					<artifactId>commons-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.yaml</groupId>
			<artifactId>snakeyaml</artifactId>
			<scope>runtime</scope>
		</dependency>
	</dependencies>

3.2 spring-boot-starter-data-jpa.jar数据库-> spring-boot-starters.pom
    	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-aop</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.apache.geronimo.specs</groupId>
					<artifactId>geronimo-jta_1.1_spec</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.apache.geronimo.specs</groupId>
					<artifactId>geronimo-jta_1.1_spec</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>javax.transaction</groupId>
			<artifactId>javax.transaction-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-jpa</artifactId>
			<exclusions>
				<exclusion>
					<groupId>org.aspectj</groupId>
					<artifactId>aspectjrt</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aspects</artifactId>
		</dependency>
	</dependencies>

3.3 spring-boot-starter-web.jar servlet-> spring-boot-starters.pom
    <dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
		</dependency>
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-validator</artifactId>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
		</dependency>
	</dependencies>

3.4 spring-boot-starter-tomcat.jar服务器->spring-boot-starters.pom
    <dependencies>
		<dependency>
			<groupId>org.apache.tomcat.embed</groupId>
			<artifactId>tomcat-embed-core</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.tomcat.embed</groupId>
			<artifactId>tomcat-embed-el</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.tomcat.embed</groupId>
			<artifactId>tomcat-embed-websocket</artifactId>
		</dependency>
	</dependencies>

3.5 spring-boot-starter-data-redis.jar第三方工具-> spring-boot-starters.pom
    <dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.data</groupId>
			<artifactId>spring-data-redis</artifactId>
		</dependency>
		<dependency>
			<groupId>redis.clients</groupId>
			<artifactId>jedis</artifactId>
		</dependency>
	</dependencies>

3.6.1.1 mybatis-spring-boot-starter.jar整合第三方-> mybatis-spring-boot.pom
    <parent>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot</artifactId>
        <version>1.1.1</version>
    </parent>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <name>mybatis-spring-boot-starter</name>
    <dependencies>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-autoconfigure</artifactId>
            <version>1.1.1</version>
        </dependency>
    </dependencies>

3.6.1.2 mybatis-spring-boot-autoconfigure.jar-> mybatis-spring-boot.pom
    <dependencies>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>${mybatis.version}</version>
		</dependency>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis-spring</artifactId>
			<version>${mybatis-spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-autoconfigure</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-jdbc</artifactId>
		</dependency>
		<!-- @ConfigurationProperties annotation processing (metadata for IDEs) -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-configuration-processor</artifactId>
			<optional>true</optional>
		</dependency>
		
		<!-- Test dependencies -->	
		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

3.6.2 mybatis-spring-boot.pom-> mybatis-parent.pom
    <modules>
        <module>mybatis-spring-boot-autoconfigure</module>
        <module>mybatis-spring-boot-starter</module>
        <module>mybatis-spring-boot-samples</module>
    </modules>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

3.6.3 mybatis-parent.pom


4.spring-boot-starters.pom-> spring-boot-parent.pom
	<modules>
		<module>spring-boot-starter</module>
		<module>spring-boot-starter-activemq</module>
		<module>spring-boot-starter-amqp</module>
		<module>spring-boot-starter-aop</module>
		<module>spring-boot-starter-artemis</module>
		<module>spring-boot-starter-batch</module>
		<module>spring-boot-starter-cache</module>
		<module>spring-boot-starter-cloud-connectors</module>
		<module>spring-boot-starter-data-cassandra</module>
		<module>spring-boot-starter-data-couchbase</module>
		<module>spring-boot-starter-data-elasticsearch</module>
		<module>spring-boot-starter-data-gemfire</module>
		<module>spring-boot-starter-data-jpa</module>
		<module>spring-boot-starter-data-ldap</module>
		<module>spring-boot-starter-data-mongodb</module>
		<module>spring-boot-starter-data-neo4j</module>
		<module>spring-boot-starter-data-redis</module>
		<module>spring-boot-starter-data-rest</module>
		<module>spring-boot-starter-data-solr</module>
		<module>spring-boot-starter-freemarker</module>
		<module>spring-boot-starter-groovy-templates</module>
		<module>spring-boot-starter-hateoas</module>
		<module>spring-boot-starter-integration</module>
		<module>spring-boot-starter-jdbc</module>
		<module>spring-boot-starter-jersey</module>
		<module>spring-boot-starter-jetty</module>
		<module>spring-boot-starter-jooq</module>
		<module>spring-boot-starter-jta-atomikos</module>
		<module>spring-boot-starter-jta-bitronix</module>
		<module>spring-boot-starter-jta-narayana</module>
		<module>spring-boot-starter-logging</module>
		<module>spring-boot-starter-log4j2</module>
		<module>spring-boot-starter-mail</module>
		<module>spring-boot-starter-mobile</module>
		<module>spring-boot-starter-mustache</module>
		<module>spring-boot-starter-actuator</module>
		<module>spring-boot-starter-parent</module>
		<module>spring-boot-starter-security</module>
		<module>spring-boot-starter-social-facebook</module>
		<module>spring-boot-starter-social-twitter</module>
		<module>spring-boot-starter-social-linkedin</module>
		<module>spring-boot-starter-remote-shell</module>
		<module>spring-boot-starter-test</module>
		<module>spring-boot-starter-thymeleaf</module>
		<module>spring-boot-starter-tomcat</module>
		<module>spring-boot-starter-undertow</module>
		<module>spring-boot-starter-validation</module>
		<module>spring-boot-starter-web</module>
		<module>spring-boot-starter-websocket</module>
		<module>spring-boot-starter-web-services</module>
	</modules>

5.1 spring-boot-parent.pom-> spring-boot-dependencies.pom
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-test-support</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>

			<!-- Additional Dependencies the consumers of spring-boot-dependencies
				will generally not need -->
			<dependency> <!-- deprecated but recent version required by 3rd party libs -->
				<groupId>log4j</groupId>
				<artifactId>log4j</artifactId>
				<version>1.2.17</version>
			</dependency>
			<dependency>
				<groupId>com.google.guava</groupId>
				<artifactId>guava</artifactId>
				<version>18.0</version>
			</dependency>
			<dependency>
				<groupId>com.squareup.okhttp</groupId>
				<artifactId>okhttp</artifactId>
				<version>2.7.5</version>
			</dependency>
			<dependency>
				<groupId>com.squareup.okhttp3</groupId>
				<artifactId>okhttp</artifactId>
				<version>3.4.1</version>
			</dependency>
			<dependency>
				<groupId>com.vaadin.external.google</groupId>
				<artifactId>android-json</artifactId>
				<version>0.0.20131108.vaadin1</version>
			</dependency>
			<dependency>
				<groupId>io.netty</groupId>
				<artifactId>netty-all</artifactId>
				<version>4.0.38.Final</version>
			</dependency>
			<dependency>
				<groupId>io.spring.gradle</groupId>
				<artifactId>dependency-management-plugin</artifactId>
				<version>1.0.3.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>jline</groupId>
				<artifactId>jline</artifactId>
				<version>2.11</version>
			</dependency>
            ......
        </dependencies>
    </dependencyManagement>

5.2 spring-boot-starter-parent.pom-> spring-boot-dependencies.pom
    <properties>
		<java.version>1.6</java.version>
		<resource.delimiter>@</resource.delimiter> <!-- delimiter that doesn't clash with Spring ${} placeholders -->
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<maven.compiler.source>${java.version}</maven.compiler.source>
		<maven.compiler.target>${java.version}</maven.compiler.target>
	</properties>
    <dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework</groupId>
				<artifactId>spring-core</artifactId>
				<version>${spring.version}</version>
				<exclusions>
					<exclusion>
						<groupId>commons-logging</groupId>
						<artifactId>commons-logging</artifactId>
					</exclusion>
				</exclusions>
			</dependency>
		</dependencies>
	</dependencyManagement>
	<build><!--定义了配置文件路径及名称-->
		<!-- Turn on filtering by default for application properties -->
		<resources>
			<resource>
				<directory>${basedir}/src/main/resources</directory>
				<filtering>true</filtering>
				<includes>
					<include>**/application*.yml</include>
					<include>**/application*.yaml</include>
					<include>**/application*.properties</include>
				</includes>
			</resource>
			<resource>
				<directory>${basedir}/src/main/resources</directory>
				<excludes>
					<exclude>**/application*.yml</exclude>
					<exclude>**/application*.yaml</exclude>
					<exclude>**/application*.properties</exclude>
				</excludes>
			</resource>
		</resources>
    </build>

5.2.1 spring-cloud-starter-parent.pom-> spring-boot-starter-parent.pom
    <dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>${spring-cloud.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

6.spring-boot-dependencies.pom
	<dependencyManagement>
		<dependencies>
			<!-- Spring Boot -->
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot</artifactId>
				<type>test-jar</type>
				<version>1.5.9.RELEASE</version>
			</dependency>
            <dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-autoconfigure</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
            <dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-data-jpa</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
            <dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-data-mongodb</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-data-redis</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
            <dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-jdbc</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
            <dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-tomcat</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
            <dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-web</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-starter-websocket</artifactId>
				<version>1.5.9.RELEASE</version>
			</dependency>
            ......

            <!-- Third Party -->
			<dependency>
				<groupId>antlr</groupId>
				<artifactId>antlr</artifactId>
				<version>${antlr2.version}</version>
			</dependency>
			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-access</artifactId>
				<version>${logback.version}</version>
			</dependency>
			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-classic</artifactId>
				<version>${logback.version}</version>
			</dependency>
			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-core</artifactId>
				<version>${logback.version}</version>
			</dependency>
            ......
        </dependencies>
    </dependencyManagement>

 类似资料: