码迷,mamicode.com
首页 > 编程语言 > 详细

第一章:Idea快速创建SpringBoot项目

时间:2018-07-24 15:50:38      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:mave   plugins   height   enc   项目结构   main   函数   scope   path   

点击新建项目:

技术分享图片

点击next:

技术分享图片

一直next ,直到创建成功。

创建完成后的项目结构如下:

技术分享图片

 

添加maven:

  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>

  

新建个类:

LessonOneApplication
@SpringBootApplication
public class LessonOneApplication {
	public static void main(String[] args) {
		SpringApplication.run(LessonOneApplication.class, args);
	}
}
@RestController
@RequestMapping
public class HelloWordController {
    @RequestMapping(value = "/index",method = RequestMethod.GET)
    public String index(){
        return "HelloWord";
    }
}

  

运行 LessonOneApplication类的主函数方法:
技术分享图片

在浏览器上测试:
技术分享图片

项目创建成功。

第一章:Idea快速创建SpringBoot项目

标签:mave   plugins   height   enc   项目结构   main   函数   scope   path   

原文地址:https://www.cnblogs.com/yaohuiqin/p/9360005.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!