Action:Consider the following: If you want an embedde ,springBoot配置数据库,补全springBoot的xml和mysql配置信息就好了

今天在敲代码时碰到了一个bug,Action:Consider the following:    If you want an embedded database (H2, HSQL or Derby), pleas

        今天在敲代码时碰到了一个bug,Action:Consider the following:    If you want an embedded database (H2, HSQL or Derby), please put 

1、这个bug该怎样解决呢?首先创建一个application.properties

2、新建flie,application.properties

3、好像跟配置端口号没有联系,后来经过查询说是:从报错来看是启动时找不到数据库的url,那来调一调

4、先创建一个yml文件:注意yml文件必须带空格

5、先看一下YAML语法

6、先创建application.yml文件

7、在pom.xml文件中导入Mysql需要的依赖

        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.2.2</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

7.1 再在application.yml将数据库的配置信息填明白他

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://ip+端口+库名?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
    username:
    password:

8、信息补全就好了,加上依赖和yml文件的配置信息竟然就变好了,如果碰到问题,可以加一下下面的群,一起讨论

发布者:admin,转转请注明出处:http://www.yc00.com/web/1738333078a4038350.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信