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

报错分析:
Description:Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could_第1张图片
分析原因之一是由于Mybatis没有找到合适的加载类,进而导致spring- datasource - url加载不成功,

解决办法:
在Pom.xml中加入下列代码后,便解决了问题。

<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 -->
<resources>
    <resource>
        <directory>src/main/java</directory>
        <includes>
            <include>**/*.yml
            **/*.properties</include>
            <include>**/*.xml
        
        false
    
    
        src/main/resources
        
            **/*.yml</include>
            <include>**/*.properties
            **/*.xml</include>
        </includes>
        <filtering>false</filtering>
    </resource>
</resources>

成功运行,截图如下所示:
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could_第2张图片

相关链接:
IntelliJ IDEA中构建Spring Boot的项目
Spring Boot中的配置文件(application.properties、application.yml与pom.xml)
ORM、JPA、Spring Data JPA和常用的五种访问数据库方式

SpringBoot–页面显示列表功能
SpringBoot–列表添加详情功能
SpringBoot–列表添加新增功能
SpringBoot–列表更新功能
SpringBoot–列表删除功能

SpringBoot的控制层注解(@Controller与@RestController)
SpringBoot的业务层注解(@Resource、@Autowired与@Qualifier)
SpringBoot的映射(@RequestMapping、@GetMapping与@PostMapping)
SpringBoot的函数参数(JavaBean对象、@RequestParam与@RequestBody)
SpringBoot的返回数据(@ResponseBody、返回templates下的网页 与 返回公共网页)

利用postman完成JSON串的发送功能(springboot)
利用postman完成数据的分页查询功能(springboot)
利用postman完成向数据库中添加数据的功能(springboot)

Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
Preparing: insert into user(uuid,username,gender,age,phone,address) values(?,?,?,?,?,?,?)
Could not autowire. No beans of ‘UserMapper‘ type found.
Error starting ApplicationContext. To display the conditions report re-run your application with
Loading class com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is com.mysql.cj.jdb
Plugin ‘org.springframework.boot:spring-boot-maven-plugin:‘ not found
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded datasource could
This application has no explicit mapping for /error, so you are seeing this as a fallback.
BootStrap-SpringBoot的使用过程中前端table表格无法加载出数据。

你可能感兴趣的:(SpringBoot(二),mybatis,java,spring,boot)