刚开始学习springboot的第一天,按照惯例首先helloworld,
开发准备:
1.开发环境jdk1.8
2.开发工具eclipse
3.项目管理工具maven
Hello World 之新建project
1.创建Maven Project (spring-boot-hello)
Hello World 之pom.xml
<!--spring boot 父节点依赖,引入这个之后相关的引入就不需要添加version配置,spring boot会自动选择最合适的版本进行添加。
-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
java.version 指定jdk版本号:
<java.version>1.8</java.version>
添加spring-boot-starter-web依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
然后maven→update project
Hello World 之coding
Codeing 步骤:新建一个Controller类
新建启动类(App – Main方法)
然后进行Run As
但是进行run as是出现一个 错误: 找不到或无法加载主类 nyist.edu.cn.App
然后在菜单栏里 project→Clean
然后程序就可以继续运行啦
在浏览器中输入 http:127.0.0.1:8080/hello
第一个helloworld完成