title: 使用idea创建spring boot 项目

参考lindaZ的IntelliJ IDEA 创建spring boot 的Hello World 项目


1.Open IDEA,choose "New-->Project" 2.Choose "Spring Initializr" -> next 3.Project Metadata: Group: com.chanchifeng
Artifact: server-system
Description: server-system project for Spring Boot -> next 4. Choose "Web" -> next 5.删除.mvn,mvnw,mvnw.cmd。

创建HelloController


HelloController.java: package com.chanchifeng.serversystem; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan; @SpringBootApplication
@ComponentScan("com.chanchifeng.serversystem.ctrl")
public class ServerSystemApplication { public static void main(String[] args) {
SpringApplication.run(ServerSystemApplication.class, args);
}
}

修改HelloController


package com.chanchifeng.serversystem.ctrl; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; /**
* @author:porschan
* @description:
* @date: Created in 10:14 2018/6/15
* @modified By:
*/ @RestController
@EnableAutoConfiguration
public class HelloController { @RequestMapping("/hello")
public String index(){
System.out.println("进入controller");
return "Hello World!";
}
}

运行com.chanchifeng.serversystem.ServerSystemApplication#main,在浏览器输入http://localhost:8080/hello,spring Boot项目搭建成功。

本博客来自https://chanchifeng.com/2018/06/15/idea-springboot/

[七月挑选]使用idea创建spring boot 项目的更多相关文章

  1. Spring Boot入门(一):使用IDEA创建Spring Boot项目并使用yaml配置文件

    由于公司最近在做技术转型(从.Net转Java),因此自己也开启了学习Java之路.学习Java怎么能不学习这几年这么火的Spring Boot框架,由于自己有总结的习惯,因此会把学习的过程以博客的形 ...

  2. 用spring tool suite插件创建spring boot项目时报An internal error occurred during: "Building UI model". com/google/common/

    本文为博主原创,未经允许不得转载 在用spring tool suite创建spring boot项目时,报一下异常: 查阅很多资料之后发现是因为装的spring tool suite的版本与ecli ...

  3. IDEA 创建Spring Boot 项目

    一.准备环境 配置Maven,打开设置页面File - Setting,快捷键Ctrl + Alt + S,找到Maven,默认是IDEA 自带的插件,User setting file 配置文件默认 ...

  4. 创建Spring Boot项目的几种方式总结

    一.我们可以使用Spring Initializr来创建SpringBoot项目. Spring Initializr从本质上来说就是一个Web应用程序,它能为你生成Spring Boot项目结构.虽 ...

  5. 使用Spring Initializer快速创建Spring Boot项目

    目录结构 IDE都支持使用Spring的项目创建向导快速创建一个Spring Boot项目:选择我们需要的模块:向导会联网创建Spring Boot项目:默认生成的Spring Boot项目: 主程序 ...

  6. Spring Boot2 系列教程(二)创建 Spring Boot 项目的三种方式

    我最早是 2016 年底开始写 Spring Boot 相关的博客,当时使用的版本还是 1.4.x ,文章发表在 CSDN 上,阅读量最大的一篇有 43W+,如下图: 2017 年由于种种原因,就没有 ...

  7. Spring Boot-初学01 -使用Spring Initializer快速创建Spring Boot项目 -@RestController+spEL -实现简单SpringBoot的Web页面

    1.IDEA:使用 Spring Initializer快速创建项目 IDE都支持使用Spring的项目创建向导快速创建一个Spring Boot项目: 选择我们需要的模块:向导会联网创建Spring ...

  8. 5分钟学会如何创建spring boot项目

    上一篇博客说了如何创建spring boot项目,但是有些同学会觉得有点麻烦,有没有什么快速学会能快速创建spring boot项目的方法,答案是肯定的.接下来我们就一起来快速创建一个spring b ...

  9. spring boot 之 如何创建spring boot项目

    创建spring boot的方式有非常多,今天我们使用maven来进行创建spring boot项目,因为maven使用的非常广泛,也很好用,很多IDE也都支持maven. 1 创建maven项目 1 ...

随机推荐

  1. 关于tomcat的server.xml里host节点配置的一些说明

    其实对这个一直搞不清楚,后来公司的网站遭遇与IIS进行整合,然后上面有几个应用需要进行配置,所以对tomcat的server.xml进行了一些深入的了解 Host的节点主要是起一个对域名解析到那个虚拟 ...

  2. mysql 5.7分组报错问题 Expression #1 of ORDER BY clause is not in GROUP BY clause 的问题 MySQL

    解决方案: select version(),@@sql_mode;SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); ...

  3. 关于Tomcat重启和关闭后重启session变化

    ,当页面第一次访问,session的attribute还未赋值,为null 当页面第二次访问时,这时当前的session的attribute有值了! 到了本文章的点题时刻!! 如果我是直接点击serv ...

  4. (转)IIS Express介绍与使用

    IIS Express是什么?IIS Express是为开发人员优化的轻量级.自包含版本的IIS.IIS Express使使用当前最新版本的IIS来开发和测试网站变得容易.它具有IIS 7及以上的所有 ...

  5. 超过 150 个最佳机器学习,NLP 和 Python教程

    超过 150 个最佳机器学习,NLP 和 Python教程 微信号 & QQ:862251340微信公众号:coderpai简书地址:http://www.jianshu.com/p/2be3 ...

  6. React Native商城项目实战03 - 包装Navigator

    1.在Home目录下新建首页详细页HomeDetail.js /** * 首页详情页 */ import React, { Component } from 'react'; import { App ...

  7. 在WCF程序中动态修改app.config配置文件

    今天在个WCF程序中加入了修改配置文件的功能.我是直接通过IO操作修改的app.config文件内容,修改后发现发现其并不生效,用Google搜了一下,在园子里的文章动态修改App.Config 和w ...

  8. -----------------解决天天模拟器不能连接adb命令

    cmd------输入adb connect 127.0.0.1:6555即可 查询日志:adb shell "logcat |grep OkHttp"

  9. Navicat12 for Mysql破解教程

    1. 注册机和Navicat网盘下载地址 链接:https://pan.baidu.com/s/1taWdnaLCPIu8xmNm1uV-Ng 提取码:no8l 2. 请先安装navicat for ...

  10. 《Using Databases with Python》Week3 Data Models and Relational SQL 课堂笔记

    Coursera课程<Using Databases with Python> 密歇根大学 Week3 Data Models and Relational SQL 15.4 Design ...