springboot-01 helloworld
第一个springboot程序
新建maven项目,添加如下依赖:
<?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.mlxs.springboot.helloworld</groupId>
<artifactId>mlxs-springboot-helloworld</artifactId>
<version>1.0-SNAPSHOT</version> <!--父依赖包-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
<relativePath/>
</parent> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependencies>
</project>
新建项目启动类:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; /**
* MainApp类描述:
*
* @author yangzhenlong
* @since 2017/2/9
*/
@SpringBootApplication
public class MainApp {
public static void main(String[] args) {
SpringApplication.run(MainApp.class, args);
}
}
新建restful接口类:
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; /**
* HelloWorldController类描述:
*
* @author yangzhenlong
* @since 2017/2/9
*/
@RestController
public class HelloWorldController { @RequestMapping("/index")
public String index() {
return "Hello World";
}
}
然后启动MainApp,浏览器中访问:http://localhost:8080/index,得到响应:
第一个springboot HelloWorld程序就完成了。
springboot-01 helloworld的更多相关文章
- [.NET MVC4 入门系列01]Helloworld MVC 4 第一个MVC4程序
[.NET MVC4 入门系列01]Helloworld MVC 4 第一个MVC4程序 一.练习项目: http://www.asp.net/mvc/tutorials/mvc-4/gettin ...
- springboot之HelloWorld
简介 为了简化开发Spring的复杂度,Spring提供了SpringBoot可以快速开发一个应用,这里就简单介绍下SpringBoot如何快速开发一个J2EE应用 HelloWorld 首先在gra ...
- ExtJS实战 01——HelloWorld
前言 Extjs5的发布已经有些日子了,目前的最新稳定版本是Extjs5.1.0,我们可以在官方网站进行下载.不过笔者今天访问得到的是502Bad Gateway,原因可能是sencha的nigix没 ...
- SpringBoot学习helloworld
这几天开始学习springBoot记录一下(Hello World) pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0 ...
- SpringBoot的HelloWorld 应用及解释
参考链接: Spring Data JPA - Reference Documentation Spring Data JPA--参考文档 中文版 纯洁的微笑:http://www.ityouknow ...
- [一]SpringBoot 之 HelloWorld
(1)新建一个Maven Java工程 (2)在pom.xml文件中添加Spring BootMaven依赖 2.1在pom.xml中引入spring-boot-start-parent spring ...
- SpringBoot入门学习(一): Idea 创建 SpringBoot 的 HelloWorld
创建项目: 项目结构: 程序启动入口: 正式开始: package com.example.demo; import org.springframework.boot.SpringApplicatio ...
- redis整合springboot的helloworld
引入依赖 compile 'org.springframework.boot:spring-boot-starter-data-redis' 使用redis有两种方法 1.Jedis Jedis je ...
- SpringBoot——探究HelloWorld【三】
前言 前面我们写了helloworld的一个,这里我们对他进行分析 探究 那么下面就开始我们的探究之旅吧,首先从POM文件来,在POM文件中我们导入了项目所需要的依赖 POM文件 父项目 <pa ...
- spring-boot的helloWorld详解
1.运行环境 开发工具:intellij idea JDK版本:1.8 项目管理工具:Maven 3.2.5 2.Maven Plugin管理 pom.xml配置代码: <project xml ...
随机推荐
- Gym-100451B:Double Towers of Hanoi
题目链接 题目大意:把汉诺双塔按指定顺序排好的最少步数 我写这题写了很久...终于发现不dp不行 把一个双重塔从一根桩柱移动到另一根桩柱需要移动多少次? 最佳策略是移动一个双重 (n-1) 塔,接着移 ...
- JDK8中的并行流
1.IntStream.parallel():获取并行流处理 2. Collection中调用parallelStream()获取并行流 3.并行排序Arrays.parallelSort()
- CentOS 7 (Linux) 下载百度网盘大文件
这个方法不仅适合下载 "百度网盘" 中的文件,还可以下载磁链之类的,总之,就是能够加快下载速度的方法. (参考了网上的多篇文章,自行实践,成功下载度盘大文件,并且提升了下载速度) ...
- (线段判交的一些注意。。。)nyoj 1016-德莱联盟
1016-德莱联盟 内存限制:64MB 时间限制:1000ms 特判: No通过数:9 提交数:9 难度:1 题目描述: 欢迎来到德莱联盟.... 德莱文... 德莱文在逃跑,卡兹克在追.... 我们 ...
- (选择不相交区间)今年暑假不AC hdu2037
今年暑假不AC Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Sub ...
- HTML5(FileRdeader)
主要作用: 异步读取存储在用户计算机上的文件(或原始缓冲区的内容),使用File或Blob对象指定要读取的文件或数据.其中File是input元素上选择文件后返回的FileList对象,也可以是拖放操 ...
- mysql同步复制异常的常见操作-传统复制方式
mysql同步复制异常的常见操作-传统复制方式 一.传统复制方式是基于非gtid的,常见的错误有1032和1062 1032是主键冲突,1062是从库中没有找到对应的记录. 可以查看出现错误的binl ...
- layui基础总结
1.layui结构 ├─css //css目录 │ │─modules //模块css目录(一般如果模块相对较大,我们会单独提取,比如下面三个:) │ │ ├─laydate ...
- CentOS 网络设置
CentOS 网络设置有两种方式配置网络可以连接外网: 自动分配与手动设置Ip 一,自动分配ip: 新装的centos6.0,用ifconfig只显示ifcfg-lo的信息,可以用ifup eth0的 ...
- JDBC-Batch 批量执行
JDBC 批处理 SQL 语句 首先在 jdbc 的 url 中加上 rewriteBatchedStatements=true,只有开启了这个 Mysql 才会执行批处理,否则还是一条一条执行 St ...