1.1 使用IntelliJ IDEA搭建Spring-Boot的"Hello World"项目
来源:互联网 发布:php服务器绑定域名 编辑:程序博客网 时间:2024/05/21 09:56
Development Software : IntelliJ IDEA 2017
Development environment : JAVA 1.8
1 : Right-click project.
@RequestMapping(value = "index")
@ResponseBody
String index(){
Development environment : JAVA 1.8
Step 1 : Create a conventional Maven project.
Step 2 : Setting configuration file ( pom.xml )
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>springboot</groupId>
<artifactId>springboot</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Step 3 : Import configuration file("pom.xml") required JAR packets
1 : Right-click project.
2 : Select "Maven" option.
3 : Click "Reimport" button.
Post Scriptum : you should execute this operation after changing the configuration file.
Step 4 : Creaet start-up file(Class file)
Post Scriptum :
1、Class file should cite (org.springframework.boot.SpringApplication、org.springframework.stereotype.Controller
、org.springframework.boot.autoconfigure.SpringBootApplication)
2、Class file should add annotation
(@Controller 、@SpringBootApplication)
Step 5 : Edit function code
@ResponseBody
String index(){
return "hello world";
}
1 : Right-click class file.
access local path
Post Scriptum :
1、@RequestMapping(value = "index") is function access path
(access this function local path is http://localhost:8080/index).
2、@ResponseBody is use to get request data.
Step 6 : Run project
1 : Right-click class file.
2 : click "Run xxxxxxxx(class name)" button.
If there is no error in the project , console will display☟
access local path
--------------------------------------------------------------------------------------------------
If there have any errors(both of English and Code) . please comment me , i'm glad to correct those.
阅读全文
1 0
- 1.1 使用IntelliJ IDEA搭建Spring-Boot的"Hello World"项目
- IntelliJ IDEA 创建spring boot 的Hello World 项目
- 使用Intellij IDEA编写Spring Hello World
- spring boot 入门(一):IntelliJ IDEA 实现hello world
- IntelliJ IDEA 开发Spring-Boot之Hello World
- 使用 intellij idea IDE 搭建 Spring boot 项目
- 使用 IntelliJ IDEA + Gradle + SpringBoot 搭建Hello World工程
- 使用 IntelliJ IDEA + Gradle + SpringBoot 搭建Hello World工程
- IntelliJ Idea搭建Groovy环境Hello World
- Spring boot使用 hello world
- Eclipse使用maven搭建简单spring boot application Hello World
- Spring Boot 的 Hello World
- Spring-boot搭建一个简单的Hello World工程
- Java springmvc web项目,基于maven的hello world入门级项目使用IntelliJ IDEA 2017版本
- IntelliJ IDEA搭建Spring Boot的小Demo
- spring boot(1)-简单搭建 Hello World
- 15.Hello World 项目创建与项目配置文件介绍 - IntelliJ IDEA 使用教程
- IntelliJ IDEA Spring Boot(8)使用JSP,打包jar文件运行带有jsp的项目
- 【linux 学习】创建快捷方式(linux mint)
- SKSEC
- 设计模式(26)--业务代表模式
- css2学习笔记整理总汇
- springmvc工作原理以及源码分析(基于spring3.1.0)
- 1.1 使用IntelliJ IDEA搭建Spring-Boot的"Hello World"项目
- Python学习零散杂记(2017-10-27)
- python_批量转换腾讯云短信模版格式
- vue读书笔记6
- 使用Android Studio开发遇到的问题集合(转载)
- 分享一个利用OpenGl处理图像的H264与H265播放器
- HDU 3478 Catch【kurskal+二分图染色】
- Linux学习:platform平台总线、平台设备、平台驱动
- Gearman详解