记录一次 springboot 集成 mybaits + H2 DaTaBase

 pom.xml


    4.0.0

    com.dnslin
    dnslin_bot
    1.0-SNAPSHOT

    
    
        org.springframework.boot
        spring-boot-starter-parent
        2.5.0
         
    


    
        8
        8
        1.8
    

    

        
            
            
                love.forte.simple-robot
                parent
                2.2.1
                import
                pom
            
        
    


    
        
        
            love.forte.simple-robot
            component-mirai-spring-boot-starter

        


        
        
            org.springframework.boot
            spring-boot-starter-logging
        


        
        
        
        
        
        
        
        
            org.springframework.boot
            spring-boot-devtools
            
            true
        

        
        
            org.springframework.boot
            spring-boot-starter-test
            test
            
                
                    org.junit.vintage
                    junit-vintage-engine
                
            
        

        
        
            com.h2database
            h2
            1.4.200
        


        
        
            org.mybatis.spring.boot
            mybatis-spring-boot-starter
            2.1.0
        

        
        
            org.projectlombok
            lombok
            1.18.2
        

        
        
            cn.hutool
            hutool-all
            5.7.13
        

        
        
            org.jsoup
            jsoup
            1.11.3
        

        
        
            com.fasterxml.jackson.core
            jackson-databind
            2.12.3
        

        
        
            org.apache.httpcomponents
            httpclient
            4.5.13
        

        
        
            org.apache.poi
            poi-ooxml
            4.1.2
        

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

    
        
            
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    
                        
                            org.project.lombok
                            lombok
                        
                    
                
            
            
                org.mybatis.generator
                mybatis-generator-maven-plugin
                1.3.2
                
                    
                    
                        com.h2database
                        h2
                        1.4.200
                    
                
                
                    
                    ${basedir}/src/main/resources/generatorConfig.xml
                    true
                
            
        
    
config.properties
jdbc.driverClass=org.h2.Driver
jdbc.url=jdbc:h2:mem:address;MODE=MySQL
jdbc.user=root
jdbc.password=root123

group.package=com.dnslin.dnslin_bot
catalog.name=address
generatorConfig.xml




    
    
        
        
        
        
        
            
            
        
        
        
        
    
        
        
            
        

        
        
            
            
            
            
        
        
        
            
            
        
        
        
            
            
        
        
        
 application.yml
simbot:
  core:
    # 扫描 simbot-bots目录下的所有 .bot 文件。
    bot-resource-type: RESOURCE_FIRST
  component:
    mirai:
      # 如果不为空,此处代表指定一个 deviceInfo 的 json文件路径。
      deviceInfo-file: src/main/resources/device.json
spring:
  # 热部署
  devtools:
    restart:
      additional-paths: src/main/java
  # 数据源
  datasource:
    driver-class-name: org.h2.Driver
    schema: classpath:db/schema.sql
#    data: classpath:db/addressAll.sql
    url: jdbc:h2:mem:address;MODE=MySQL
    username: root
    password: root123
  h2:
    console:
      enabled: true
      path: /h2
      settings:
        trace: true
        web-allow-others: true
#  配置mybatis:
mybatis:
  mapper-locations: classpath:mapper/*.xml
  configuration:
    map-underscore-to-camel-case: true

# 日志
logging:
  level:
    love.forte.simbot: debug
    com.dnslin.dnslin_bot: debug
最后修改:2023 年 10 月 05 日
如果觉得我的文章对你有用,请随意赞赏