解析springboot里的pom文件和对应配置解析(一)

利用Idea的默认设置创建springboot项目,pom文件的结构如下

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
   <!-- 依赖的springboot父类,统一版本号,后面依赖版本号和父类一致的可以不用写(2.1.3)--> 
  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/> <!-- lookup  -->
    </parent>
    <groupId>com.hpc</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>
  <!-- 配置java版本(必配)和变量区 -->
    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
     <!-- springboot的启动依赖(集成tomcat) -->
     <!-- 这里是spring-boot-starter-web 而不是 spring-boot-starter -->
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
    <!-- springboot的测试依赖-->
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!-- lombok依赖 -->
     <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency>
    
<!-- jdbc6 的依赖(需指定版本) -->     <dependency>     <groupId>mysql</groupId>     <artifactId>mysql-connector-java</artifactId>    <version>6.0.6</version>     </dependency> 
    <!-- jdbc6 配置文件 yml格式 6.06的驱动名字 com.mysql.cj.jdbc.Driver -->
 <!-- spring:
      datasource:
        type: com.zaxxer.hikari.HikariDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
         username: root
        password: 123456
        url: jdbc:mysql://192.168.1.94:3306/gca?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Shanghai -->

  </
dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>

 

posted @ 2019-03-25 18:50  闭眼的鱼  阅读(3887)  评论(0编辑  收藏  举报