项目实施-01 (Maven依赖+yml文件)

SpringBoot 项目的Maven 坐标

Maven中心仓库地址链接
此次项目采用 SpringBoot框架,因此引入以下依赖。


<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0modelVersion>
    
    <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.1.5.RELEASEversion>
    parent>

    <groupId>com.***groupId>
    <artifactId>UserModelartifactId>
    <version>1.0-SNAPSHOTversion>

    <properties>
        <java.version>1.8java.version>
    properties>

    <dependencies>
        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <scope>testscope>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-aopartifactId>
        dependency>


        
        <dependency>
            <groupId>org.apache.tomcat.embedgroupId>
            <artifactId>tomcat-embed-jasperartifactId>
            <scope>providedscope>
        dependency>


        
        <dependency>
            <groupId>jstlgroupId>
            <artifactId>jstlartifactId>
            <version>1.2version>
            <scope>providedscope>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-configuration-processorartifactId>
            <optional>trueoptional>
        dependency>

        
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-devtoolsartifactId>
        dependency>


        
        <dependency>
            <groupId>commons-fileuploadgroupId>
            <artifactId>commons-fileuploadartifactId>
            <version>1.3.3version>
        dependency>


        
        <dependency>
            <groupId>mysqlgroupId>
            <artifactId>mysql-connector-javaartifactId>
            <version>5.1.44version>
        dependency>

        
        <dependency>
            <groupId>com.alibabagroupId>
            <artifactId>druidartifactId>
            <version>1.1.10version>
        dependency>

        
        <dependency>
            <groupId>org.mybatis.spring.bootgroupId>
            <artifactId>mybatis-spring-boot-starterartifactId>
            <version>1.3.2version>
        dependency>


        
        <dependency>
            <groupId>org.projectlombokgroupId>
            <artifactId>lombokartifactId>
            <version>1.18.8version>
            <scope>providedscope>
        dependency>
        
    dependencies>

    <build>
        
        <plugins>
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
            plugin>
        plugins>
    build>

project>

补充

以下是对于项目扩展使用的一些使用依赖坐标

redis & elastic search



  
    <dependency>
      <groupId>redis.clientsgroupId>
      <artifactId>jedisartifactId>
      <version>2.9.0version>
    dependency>

    
    <dependency>
      <groupId>org.springframework.bootgroupId>
      <artifactId>spring-boot-starter-data-redisartifactId>
    dependency>


  
    <dependency>
      <groupId>org.springframework.sessiongroupId>
      <artifactId>spring-session-data-redisartifactId>
    dependency>


 
    <dependency>
      <groupId>org.elasticsearchgroupId>
      <artifactId>elasticsearchartifactId>
      <version>6.2.4version>
    dependency>

   
    <dependency>
      <groupId>org.elasticsearch.clientgroupId>
      <artifactId>transportartifactId>
      <version>6.2.4version>
    dependency>

   
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-data-elasticsearchartifactId>
        dependency>


SpringBoot 的配置文件通用模板

#服务器设置-----------------------
server:
  port: 9090
  servlet:
    #热部署
    jsp:
      init-parameters:
        development: true
    # post表单提交乱码
    context-path: /user
  tomcat:
    uri-encoding: UTF-8


#Spring设置-----------------------
spring:
  #编码规则
  http:
    encoding:
      charset: UTF-8
      force: true
      #全局收参日期格式
  mvc:
    date-format: yyyy-MM-dd
    #视图解析器
    view:
      prefix: /
      suffix: .jsp
      #配置数据源(读写分离数据源)
  datasource:
    #配置自定义数据源1
    master:
      type: com.alibaba.druid.pool.DruidDataSource
      username: root
      password: 0
      driver-class-name: com.mysql.jdbc.Driver
      jdbc-url: jdbc:mysql://10.10.0.151:3306/project?useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC&useSSL=false
    #配置自定义数据源2
    slave1:
      type: com.alibaba.druid.pool.DruidDataSource
      username: root
      password: 0
      driver-class-name: com.mysql.jdbc.Driver
      jdbc-url: jdbc:mysql://10.10.0.152:3306/project?useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC&useSSL=false
    #配置自定义数据源3
    slave2:
      type: com.alibaba.druid.pool.DruidDataSource
      username: root
      password: 0
      driver-class-name: com.mysql.jdbc.Driver
      jdbc-url: jdbc:mysql://10.10.0.152:3306/project?useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC&useSSL=false



    #Mycat数据源
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://10.10.0.151:8066/mycat #连接mycat逻辑库
    username: root
    password: root
  #单机数据源
    type: com.alibaba.druid.pool.DruidDataSource
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/project?useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC&useSSL=false
 #   username: root
 #   password: 123

 # Mycat 数据源

  #出参的全局格式
  jackson:
    date-format: yyyy-MM-dd
    time-zone: GMT+8
  #文件上传配置
  servlet:
    multipart:
      enabled: true
      max-file-size: 5MB
      max-request-size: 50MB
      location: /E:/temp  #指定临时目录


  #连接redis
  redis:
    host: 10.10.0.152
    port: 6379
    timeout: 5s #超时时间
    lettuce:
      pool:
        max-active: 10 #最大活动数
        max-idle: 8 #最大闲置数
        max-wait: 5ms #最大等待数
        min-idle: 1 #最小闲置数
      shutdown-timeout: 100ms #超时停机时间

#mybatis设置-----------------------
mybatis:
  mapper-locations: classpath:com/baizhi/mapper/*.xml
  type-aliases-package: com.baizhi.entities
  executor-type: batch #开启mybatis的批处理


#设置日志等级-----------------------
logging:
  level:
    root: error
    com.baizhi.dao: debug
    com.baizhi.service: warn
    com.baizhi.controller: warn

#文件系统
fdfs:
  tracker-list: pro1:22122,pro2:22122
  # 配置默认缩略图
  thumb-image:
    height: 80
    width: 80



你可能感兴趣的:(数据综合分析系统)