您的位置:首页 > 编程语言 > Java开发

第一个SpringBoot项目

2020-04-02 18:49 387 查看

第一个SpringBoot项目HelloController

搭建指南

参考:https://blog.csdn.net/qq_40147863/article/details/84194493

遇到的问题·

  1. import org.springframework.web时,springframework是红的
    方案:检查idea中maven路径,file—setting-搜索maven

    然后import changes

  2. 运行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 class

    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.

    方案:程序入口替换为
    @SpringBootApplication(exclude={DataSourceAutoConfiguration.class})
    此时,找不到类DataSourceAutoConfiguration.class,点击Alt+Enter可解决

  3. 浏览器报错404
    HelloController忘加@RestController

  • 点赞
  • 收藏
  • 分享
  • 文章举报
俺老李 发布了3 篇原创文章 · 获赞 0 · 访问量 63 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: