Springboot启动时报错Property ‘mapperLocations‘ was not specified.

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群版 2核4GB 100GB
推荐场景:
搭建个人博客
云数据库 RDS MySQL,高可用版 2核4GB 50GB
简介: Springboot启动时报错Property ‘mapperLocations‘ was not specified.

阐述

这几天没整boot

晚上直接运行不了了

本想是在表现层写点代码测测接口的

localhost8080找半天 结果404

先考虑好久 是不是url输入错了 然后 就发现

结果boot都不能启动了

JUnit也测不出来

找了半天

结果是开关机导致数据库没开

手动打开服务

找到MySQL启动

IDEA连接数据库

再选择架构

这样测试过了 但还是无法启动boot

看了boot的启动信息

分析一下

应该是配置文件没弄

哎 让我配新驱动

更新驱动后还是无法启动boot

上网查了查这个意思

Registered plugin: 'com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor@20ed3303'
Property 'mapperLocations' was not specified.

就是找不到mapper的配置文件了

在以前在数据层会有一个dao层的xml文件

里面有配置信息

我们现在在配置文件application进行了统一配置

说明我们的配置文件书写错误

导致无法扫描

配置信息无法加载

就是找不到Mapper的坐标

找不到mapperLocations

配置文件写错了

我们看看

server:
  port: 8080
 
#下面这些内容是为了让MyBatis映射
#指定Mybatis的Mapper文件
 
# 专门用来配置的对象datasource
spring:
  datasource:
    druid:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC
      username: root
      password: 123456
 
# 配置mybatis-plus
mybatis-plus:
  global-config:
    db—config:
      table-prefix: tbl_
      id-type: auto
 
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
 

是不是这个啊

删了

就能运行了、

还是不能

下面格式也不对

应该这样

就能运行了

server:
  port: 8080
 
#下面这些内容是为了让MyBatis映射
#指定Mybatis的Mapper文件
 
# 专门用来配置的对象datasource
spring:
  datasource:
    druid:
      driver-class-name: com.mysql.cj.jdbc.Driver
      url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC
      username: root
      password: 123456
 
# 配置mybatis-plus
mybatis-plus:
  global-config:
    db—config:
      table-prefix: tbl_
 
configuration:
  log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
1月前
|
Java
SpringBoot启动报错:org.apache.catalina.LifecycleException: Protocol handler start failed
SpringBoot启动报错:org.apache.catalina.LifecycleException: Protocol handler start failed
50 0
|
1月前
|
Java
SpringBoot启动报错org.apache.catalina.LifecycleException
SpringBoot启动报错org.apache.catalina.LifecycleException
19 0
|
21天前
|
Java Spring
解决Springboot集成ElasticSearch 报错:A bean with that name has already been defined in null and overriding
解决Springboot集成ElasticSearch 报错:A bean with that name has already been defined in null and overriding
|
14天前
|
Java 关系型数据库 MySQL
【已解决】SpringBoot 启动报错:Failed to configure a DataSource: ‘url‘ attribute is not specified and no emb
【已解决】SpringBoot 启动报错:Failed to configure a DataSource: ‘url‘ attribute is not specified and no emb
29 0
|
15天前
|
Java
SpringBoot启动报错:Unable to start LiveReload server【已解决】
SpringBoot启动报错:Unable to start LiveReload server【已解决】
15 0
|
1月前
|
监控 druid Java
Druid【SpringBoot集成】监控数据库报错 Failed to bind properties under ‘‘ to javax.sql.DataSource 解决(含配置源码)
Druid【SpringBoot集成】监控数据库报错 Failed to bind properties under ‘‘ to javax.sql.DataSource 解决(含配置源码)
297 0
|
1月前
|
Java 测试技术 Maven
Spring Boot单元测试报错java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]
Spring Boot单元测试报错java.lang.IllegalStateException: Could not load TestContextBootstrapper [null]
|
1月前
|
安全 Java
Springboot2.1.1版本升级到2.3.10版本报错合集及解决办法
Springboot2.1.1版本升级到2.3.10版本报错合集及解决办法
|
1月前
|
Java 测试技术 数据库
SpringBoot启动时设置不加载数据库
SpringBoot启动时设置不加载数据库
56 0
|
1月前
|
Java
springboot启动报错:“Error starting ApplicationContext. To display the conditions report re-run your appl
springboot启动报错:“Error starting ApplicationContext. To display the conditions report re-run your appl
101 0