Springboot helloworld入门最经典例子
2017-08-28 17:06
381 查看
一、建立maven java项目
导入springboot包二、配置pom.xml
<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.ij34.example</groupId> <artifactId>Bootproject</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>Bootproject</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.6.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> </project>
三、代码测试
package hello; import java.util.Date; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * @author Admin * @date 创建时间:2017年8月28日 下午4:14:54 * @version 1.0 *@type_name SampleController */ @Controller @EnableAutoConfiguration public class SampleController { @RequestMapping("/") @ResponseBody String home(){ return "Hello World:"+new Date(); } public static void main(String[] args) { // TODO Auto-generated method stub SpringApplication.run(SampleController.class, args); } }
附加:spring-boot-cli下载地址
http://repo.spring.io/release/org/springframework/boot/spring-boot-cli/
相关文章推荐
- spring boot 初试,springboot入门,springboot helloworld例子
- spring boot Hello World(新手入门)
- struts2入门-第一个例子==》第一个struts2实例——HelloWorld==》Struts2.0搭建和简单实例==>写一个Steuts2的经典入门案例,做了一个登陆程序作为入门例子
- Spring Boot之Hello World
- spring-boot 第一天 hello-world
- day2-180315-springboot经典入门案例
- spring security helloworld例子操作
- springboot Hello World
- idea springboot helloworld出错
- idea+maven+springboot hello world
- spring boot入门例子
- SpringBoot HelloWorld
- SpringBoot之简介及"HelloWorld"
- 经典的Spring 入门级例子
- SpringBoot HelloWorld实现
- springboot开发 第一个案例之hello,world!
- typescript 入门例子 Hello world——ts就是一个宿主机语言
- Spring Boot 光速入门秘籍,经典之中的经典呀!
- spring boot 入门之security oauth2 jwt完美整合例子-java编程
- 经典的Spring 入门级例子