SpringBoot开发第1章,Ideal开发设
一、下载Idea安装,地址:https://www.jetbrains.com/idea/download/other.html,我使用的社区版
二、下载jdk,安装jdk,配置环境变量
新建JAVA_HOME 系统变量,设置jdk安装路径
再path变量中后面添加,%JAVA_HOME%\bin
检查jdk是否安装成功,执行Java -version
λ java -version java version "1.8.0_231" Java(TM) SE Runtime Environment (build 1.8.0_231-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)
四、配置 maven ,
-
- 下载maven , https://archive.apache.org/dist/maven/maven-3/3.6.2/binaries/
- 设置maven环境变量,再path后面添加 C:\software\apache-maven-3.6.2\bin ,测试是否正常
λ mvn -v Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0) Maven home: C:\software\apache-maven-3.8.5 Java version: 1.8.0_231, vendor: Oracle Corporation, runtime: C:\software\Java\jdk1.8.0_231\jre Default locale: zh_CN, platform encoding: GBK OS name: "windows 10" , version: "10.0" , arch: "amd64" , family: "windows"
3. 新建一个本地仓库地址,C:\software\localRepository
设置conf/settings.xml配置文件,设置阿里云仓库和本地仓库
复制出来,设置本地仓库 C: //software//localRepository 设置阿里云仓库,根据maven.aliyun.com帮助设置 aliyunmaven * 阿里云公共仓库 https: //maven.aliyun.com/repository/public
- 设置ideal=》setting=maven仓库地址,
五、创建maven项目
六、手工搭建springboot项目,添加pom引用,让后加载
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.9</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
七、增加文件夹,输入如下代码
package example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@EnableAutoConfiguration
public class Example {
@RequestMapping("/")
String home(){
return "HelloWolrd888";
}
public static void main(String[] args){
SpringApplication.run(Example.class,args);
}
}
八、运行使用 mvn spring-boot:run 或者配置启动
九、输入网址HTTP local host:8088
posted on 2022-10-04 23:43 topguntopgun 阅读(383) 评论(0) 编辑 收藏 举报