关于初次new springboot项目

发布时间 2023-09-23 16:48:33作者: 妹崽insisting

如果是新手初学,然后做springboot项目报各种错,改来改去最终都无法出现successful字样。

请先检查,maven环境是否配好。

maven环境决定你下载依赖的速度,以及能否下载成功。

 

maven管理你的springboot项目,所以配置它的环境是必不可少的。

 

比如未配置maven环境直接运行项目可能会报以下错误。

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

 

java: 无法访问jakarta.persistence.Column 错误的类文件: balabala...

 

警告: Runner org.junit.internal.runners.ErrorReportingRunner (used on com.itheima.BookJpaTests) does not support filtering and will therefore be run completely. org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.itheima.BookJpaTests': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.

 

NoSuchBeanDefinitionException: No qualifying bean of type 'com.itheima.stutest01.repository.BookRepository' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:balabala

 

 

可能有些帖子写,无启动类路径。如果maven环境一开始有配好,new出来的项目,自带balalbatest.java的文件,中是自带启动注解的 

@RunWith(SpringRunner.class)

      ------->