springBoot 学习记录(一)
2017-06-01 15:27
489 查看
第一 : 新建maven web项目
第二: 在pom.xml 写上spingBoot代码:
<?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>com.phpfzh</groupId>
<artifactId>springboot01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
第三: 新建测试Controller
代码如下:
package springboot01;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@SpringBootApplication
@Controller
public class UserController {
@RequestMapping("/")
@ResponseBody
public String test(){
System.out.println("====================");
return "你好您好Hello Wordsfdd !fgdfgfhgfhgf";
}
public static void main(String[] args){
SpringApplication.run(UserController.class, args);
}
}
第四: 右击项目 点击 run As ==> Maven clear ====> maven install ===> 运行main 函数 ===》 在浏览器输入:localhost:8080/
安装maven 和maven 插件请自行搜索
第二: 在pom.xml 写上spingBoot代码:
<?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>com.phpfzh</groupId>
<artifactId>springboot01</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
第三: 新建测试Controller
代码如下:
package springboot01;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@SpringBootApplication
@Controller
public class UserController {
@RequestMapping("/")
@ResponseBody
public String test(){
System.out.println("====================");
return "你好您好Hello Wordsfdd !fgdfgfhgfhgf";
}
public static void main(String[] args){
SpringApplication.run(UserController.class, args);
}
}
第四: 右击项目 点击 run As ==> Maven clear ====> maven install ===> 运行main 函数 ===》 在浏览器输入:localhost:8080/
安装maven 和maven 插件请自行搜索
相关文章推荐
- Spring boot 学习记录
- Eclipse安装Spring插件 学习SpringBoot的应该用的到 -这个一定要记录下来
- Spring Boot学习记录(二)--thymeleaf模板
- SpringBoot 学习记录(五)- 文件上传(和图片服务器fastdfs测试)
- springBoot 学习记录(二)-返回json数据的几种方式
- SPRING-BOOT入门学习记录
- SpringBoot 学习记录(八): properties 属性自定义
- SpringBoot 学习记录(十一): hazelcast+swagger2
- SpringBoot-Mybatis_Plus学习记录之公共字段自动填充
- springBoot 学习记录(四)- 访问jsp页面
- spring boot 学习(六)spring boot 各版本中使用 log4j2 记录日志
- SpringBoot学习:使用logback进行日志记录
- SpringBoot 学习记录(一): 简单web项目
- Spring Boot学习记录(四)--问题记录
- Spring Boot学习记录(三)--整合Mybatis
- Spring Boot学习记录(二)--thymeleaf模板
- SpringBoot 学习记录(三): jpa
- SpringBoot 学习记录(四): slf4j+logback
- SpringBoot 学习记录(三)- Junit 单元测试
- spring-boot学习记录