SpringBoot(一)_Eclipse的安装和使用
1.Eclipse中安装STS插件:
Help -> Eclipse Marketplace…
Search或选择“Popular”标签,选择Spring Tool Suite (STS) for Eclipse插件,安装:
2.New -> Project…
找到Spring目录,选择Spring Starter Project,Next
3、填写跟项目相关的各种信息,然后Next
4.选择需要的Dependency,然后Next:
5.Next,然后Finsh,新项目就创建好了,各个目录如下:
6.右键MySpringBootApplication中的main方法,Run As -> Spring Boot App,项目就可以启动了。
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MySpringBootApplication {
public static void main(String[] args) {
SpringApplication.run(MySpringBootApplication.class, args);
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
由于选择了web dependency默认启动一个Tomcat,8080端口监听
7.把application.properties改名为application.yml(个人喜欢),修改Tomcat的启动端口:
server:
port: 8081
转载至 http://blog.csdn.net/xuli99999/article/details/53926765