使用intellj IDEA搭建SpringBoot项目

使用intellj IDEA搭建SpringBoot项目

 
  1. springBoot作为当下很流行的框架,因其高性能和简化配置收到广大开发人员的青睐。

  2. 那么如果搭建一个SpringBoot项目呢。今天我来给大家演示下最简单的搭建教程。

一、创建一个project

二、选择Spring Initializr,然后直接next

 

三、修改自己的groupid和artifactId,点击next

 

四、选择需要的属性,这里我简单的选择web,你可以根据自己的需要加上mysql、MongoDB、myBatis等,另外右上角还可以设置boot的版本

 

五、填写项目名称然后就完成了。

 

六、打开项目后架构如图,直接删除该3个文件

 

七、默认的启动类就是DemoApplication

 

八、这里写一个contoller测试一下

 

代码如下:
 
  1. package com.example.demo;

  2.  
  3. import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

  4. import org.springframework.web.bind.annotation.RequestMapping;

  5. import org.springframework.web.bind.annotation.RestController;

  6.  
  7. /**

  8. * @Created by liuchujian On 2018/7/5

  9. */

  10. @RestController

  11. @EnableAutoConfiguration

  12. public class IndexController {

  13.  
  14. @RequestMapping("/index")

  15. public String sayHello() {

  16. return "hello! this is my first springboot code!";

  17. }

  18. }

九、运行main方法启动boot,在浏览器输入 http://localhost:8080/index访问如图

 

大功告成!一个简单的springBoot项目就此搭建完成!喜欢可以关注一波哦~

转载于:https://my.oschina.net/u/3708863/blog/1840968

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值