1.1 使用IntelliJ IDEA搭建Spring-Boot的"Hello World"项目
2017-10-27 11:07
639 查看
Development Software : IntelliJ IDEA 2017Development environment : JAVA 1.8Step 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> 4000
</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 packets1 : 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 fileshould 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@RequestMapping(value = "index")@ResponseBodyString index(){return "hello world";}Post Scriptum : 1、@RequestMapping(value = "index") isfunction access path(accessthis function local path is http://localhost:8080/index).2、@ResponseBody isuse to get request data.Step 6 : Run project1 : 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.
相关文章推荐
- VS Code打开使用IDEA搭建的Spring Boot项目运行提示"snakeyaml was not found on the classpath"错误
- Eclipse使用maven搭建简单spring boot application Hello World
- 【项目搭建】使用spring-boot进行REST风格的微服务开发入门
- 《Gradle教程系列》四.使用gradle搭建SpringBoot项目
- 使用spring boot搭建与dubbo整合项目
- springboot入门-hellospringboot项目搭建
- 如何使用eclipse搭建SpringBoot项目
- 使用maven 快速搭建springboot项目
- 使用IDEA和Maven搭建一个Spring Boot项目
- 使用SpringBoot搭建小型项目,集成mybatis,redis,swagger2,并部署在外部容器中。
- Spring的"Hello, world",还有"拿来主义"
- 使用eclipse搭建springboot项目
- 使用idea+springboot+Mybatis搭建web项目
- Myeclipse下使用Maven搭建spring boot项目
- springboot 使用thymeleaf 模板引擎时报错org.xml.sax.SAXParseException: 元素类型 "link" 必须由匹配的结束标记 "</link>" 终止
- Spring Cloud搭建微服务架构----使用Spring boot开发web项目
- 使用C#编写不同的"Hello World"程序(转)
- 使用idea+springboot+Mybatis搭建web项目
- SpringBoot Helloworld 测试 Maven项目
- Spring Boot Hello World (使用Eclipse IDE)