搭建指南
参考:https://blog.csdn.net/qq_40147863/article/details/84194493
遇到的问题·
-
import org.springframework.web时,springframework是红的
方案:检查idea中maven路径,file—setting-搜索maven
然后import changes
-
运行DemoApplication.java时,报错:
Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver classIf you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
方案:程序入口替换为
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
此时,找不到类DataSourceAutoConfiguration.class,点击Alt+Enter可解决 -
浏览器报错404
HelloController忘加@RestController