创建SpringBoot——Spring Initialize

Springboot依赖组件介绍:here

操作参考:here,如果配置后pom.xml内爆红未导入,那么在dependencise 界面中多选入:Web-Spring Web Service选项即可。

报错1:Failed to configure a DataSource: 'url' attribute is not specified and no em

参考:here,配置数据库即可。

复制代码
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.password=root
application.properties
复制代码

 

报错2:Loading class `com.mysql.jdbc.Driver'. This is deprecated. 

参考:here,更新数据库驱动即可。

  按照提示更改jdbc.properties配置 com.mysql.jdbc.Driver 改为 com.mysql.cj.jdbc.Driver

报错3:

Springboot-helloworld之Whitelabel Error Page

参考:here,因为包扫描路径未扫描到controller,添加扫描或更改路径即可。

 

springboot如何进行简单的测试

参考:here,一定要在默认配置的test内测试,不能新建test包允许,因为两个SpringBootApplication不能存(会导致原main无法启动)

 

Spring Boot整合Druid数据源

参考:here

报错1:you need to use @ContextConfiguration or @SpringBootTest(classes=...) 

参考:here,那是因为@SpringBootTest中缺少classes属性配置,加上启动类的class即可。

@SpringBootTest(classes = 默认Application全名.class)

【Over】

posted @   Renhr  阅读(95)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 一起来玩mcp_server_sqlite,让AI帮你做增删改查!!
· 零经验选手,Compose 一天开发一款小游戏!
点击右上角即可分享
微信分享提示