idea项目 --- 1.依赖和配置

1.新建一个项目(Sql开发的是JPA的使用)
2.在pom.xml中导入依赖(只有部分常用的剩下的需要自己添加)

  
    
        org.springframework.boot
        spring-boot-starter-web
    

    
        org.springframework.boot
        spring-boot-devtools
        runtime
        true
    
    
        org.springframework.boot
        spring-boot-starter-test
        test
    

    
    
        commons-lang
        commons-lang
        2.6
    
    
        commons-io
        commons-io
        2.3
    
    
        org.projectlombok
        lombok
        1.16.10
    
    
        com.alibaba
        fastjson
        1.2.47
    


    
    
        mysql
        mysql-connector-java
        8.0.16
    
    
        com.querydsl
        querydsl-jpa
    
    
        com.querydsl
        querydsl-apt
    
    
    
        org.springframework.boot
        spring-boot-starter-data-jpa
    


    
    
        org.mybatis.spring.boot
        mybatis-spring-boot-starter
        1.1.1
    


    
    
        org.springframework.boot
        spring-boot-starter-thymeleaf
    

    
        org.springframework.boot
        spring-boot-devtools
        true
    
    




    
        
            org.springframework.boot
            spring-boot-maven-plugin
        
        
        
            org.apache.maven.plugins
            maven-compiler-plugin
            3.8.1
            
                1.8
                1.8
            
        
        
            com.mysema.maven
            apt-maven-plugin
            1.1.3
            
                
                    
                        process
                    
                    
                        target/generated-sources/java
                        com.querydsl.apt.jpa.JPAAnnotationProcessor
                    
                
            
        

    

3.在application.yml中进行配置

server:
  port: 1100
  #服务器的使用
  obsCdn:
  host: http://81.70.220.54
spring:
  thymeleaf:
    prefix:
      classpath: /templates/
    suffix: .html
    mode: HTML
    encoding: UTF-8
    servlet:
      content-type: text/html
  #数据库
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://81.70.220.54:3306/student?characterEncoding=UTF-8&serverTimezone=GMT%2B8
    username: root
    password: password
  servlet:
    multipart:
      max-request-size: 1000MB
      max-file-size: 100MB
  jpa:
    #配置数据库类型
    database: MYSQL
    #配置是否打印sql
    show-sql: true
    #Hibernate相关配置
    hibernate:
      #配置级联等级
      ddl-auto: update
      naming:
        #命名策略 遇到大写字母 加”_”的命名。
        strategy: org.hibernate.cfg.ImprovedNamingStrategy
    properties:
      hibernate:
        dialect: org.hibernate.dialect.MySQL5Dialect
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8
#mybatis配置文件
mybatis:
  mapperLocations: classpath:Mapper/*.xml
  type-aliases-package: com.test.demoApp.Domain
  #图片存放地
userPhoto:
  urlPrefix: /user/getPhoto
  store:
    path: /deploy/student/Phone/user
  obsPath: /user/getPhoto
cbs:
  videosPath: file:D:/testFile/video/
  imagesPath: file:D:/testFile/image/  

4.在resources资源文件下新建mybatis-generator.xml配置数据及mybatis










    
    
     
    
        
    

    
    
        
        

    

    
    
        
    

    
    
    
        
        
        
    

    
    
        
    

    
    
        
    

    
    

5.数据库的具体使用看idea项目 --- 2.数据库的使用(简单方便)

你可能感兴趣的:(idea项目 --- 1.依赖和配置)