【Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource coul】

编程入门 行业动态 更新时间:2024-10-19 19:41:15

【Failed to configure a <a href=https://www.elefans.com/category/jswz/34/1770855.html style=DataSource: ‘url‘ attribute is not specified and no embedded datasource coul】"/>

【Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource coul】

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could 项目启动报错后总结的分析方法

            • 在Spring Boot 项目刚搭建好时启动出现标题上描述的报错。
            • 问题分析方法:

在Spring Boot 项目刚搭建好时启动出现标题上描述的报错。
问题分析方法:
  • 先判断是否是数据库连接配置出错;在启动类的@SpringBootApplication注解后加上(exclude= {DataSourceAutoConfiguration.class})断开与数据库的连接操作,测试是否可以正常启动。
  • 再次启动项目依然报错!再检查数据库连接是否有误。
  • 如果确定连接没问题就去看mybatis or mybatis-plus 在pom中导入的是否正确。以及在application.yml里是否对其做了配置
    本次项目(2022-8-22)用了mybatis-plus。只用导以下依赖就可以
    <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.0.3</version> </dependency>
    application.yml中配置如下
mybatis-plus:mapper-locations: classpath*:/mapper/**/*.xml#实体扫描,多个package用逗号或者分号分隔typeAliasesPackage: com.lineAlgorithm.lineAlgorithm.entryglobal-config:#数据库相关配置db-config:#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"field-strategy: NOT_NULL#      logic-delete-value: -1#      logic-not-delete-value: 0banner: false#原生配置configuration:map-underscore-to-camel-case: truecache-enabled: falsecall-setters-on-nulls: truejdbc-type-for-null: 'null'

更多推荐

【Failed to configure a DataSource: ‘url‘ attribute is not specified and no embed

本文发布于:2024-03-12 11:40:54,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1731424.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:DataSource   url   Failed   configure   datasource

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!