[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ed3lU7Su-1650616354428)(https://img-blog.csdnim位置g.cn/475f7cb12844435eba0a5fc929424b59.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBA5rWB5pme5YS_d3c=,size_20,color_FFFFFF,t_70,g_se,x_16)]
5.选择项目存放位置 6.添加Maven,这里需要自己去官网下载maven。 7.在–》apache-maven-3.8.5conf,找到settings.xml修改路径 8.添加上maven后,可以运行项目。
在初次完成项目的构建后,启动项目时出错,提示信息“ Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured. ” ,异常指的是 “ 配置数据源失败:没有指定’url’属性,也不能配置嵌入式数据源。 ” ,如下图:
在 SpringBoot 应用程序启动时,排除 jdbc 的自动装配机制即可,在程序入口文件中新增配置注解 “ exclude=DataSourceAutoConfiguration.class ”
package com.example.demo.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/first")
public class FirstController {
@GetMapping("/boot")
public String getFirst(){
return "我在这里啊";
}
}
3.访问链接
三、可以访问https://start.spring.io/快速搭建



