解决方法 If you want an embedded database (H2, HSQL or Derby), please put it on the classpath

场景

Springboot 2.5.1集成 mybatis-plus-boot-starter 3.3.2 报错

Consider the following:
	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


Process finished with exit code 1

解决方法 

#spring:
#  datasource:
#  druid:
#      url:
#      username: root
#      password: 123456
#      driver-class-name: com.mysql.cj.jdbc.Driver

# 替换为:

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/datapro?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123456

相关环境配置

        
        
            com.baomidou
            mybatis-plus-boot-starter
            3.3.2
        
        
            com.alibaba
            druid-spring-boot-starter
            1.1.13
        
        
        
            com.baomidou
            mybatis-plus-generator
            3.4.1
        

        
            org.apache.velocity
            velocity-engine-core
            2.3
        
        
            org.springframework.boot
            spring-boot-starter-data-jdbc
        
        
            mysql
            mysql-connector-java
            runtime
        
        
            org.freemarker
            freemarker
            2.3.31
        

        
            com.github.pagehelper
            pagehelper-spring-boot-starter
            1.2.12
        

MybatisPlusConfig配置

@Configuration
@MapperScan("com.data.xxx.dao")
public class MybatisPlusConfig {

}

application.yml配置

#spring:
#  datasource:
#  druid:
#      url:
#      username: root
#      password: 123456
#      driver-class-name: com.mysql.cj.jdbc.Driver

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/datapro?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: 123456

mybatis-plus:
    mapper-locations: classpath:mappers/*.xml
    type-aliases-package: com.data.xxx.entity
    configuration:
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

pagehelper:
  helper-dialect: mysql
  reasonable: true
  support-methods-arguments: true
  pageSizeZero: true
  params: count=countSql

你可能感兴趣的:(Java文档,Spring系统整理,Mybatis从入门到精通,mybatis,spring,boot,java)