创建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 @ 2022-05-05 12:27  Renhr  阅读(109)  评论(0)    收藏  举报