idea搭建简单spring-boot项目

1.创建空项目

file->new->project->maven->next

自定义名字,下一步

自定义名字,然后next,创建好项目

2.在pom.xml中加入依赖

 <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

3.在main.java目录下创建目录并创建Application.java类和controller.java类
目录级别例如:

Application.java类
@SpringBootApplication
public class Application {
public static void main(String []args){
SpringApplication.run(Application.class,args);
}
}


Controller.java类
@RestController
@Slf4j
public class HanlpController {
@RequestMapping(value = "/getMechanism",method = RequestMethod.POST)
public String getMechanism(String article){
System.out.println(article);
return "success";
}
}

4.启动项目


 

posted @ 2017-06-16 11:16  青狼_兴  阅读(1132)  评论(0编辑  收藏  举报