SpringBoot学习之hello world
来源:互联网 发布:mac蓝光播放软件 编辑:程序博客网 时间:2024/06/05 10:55
Spring Boot是什么?
一个很好的框架 ,Spring Boot可以轻松创建可以独立运行的 、生产级别的Spring应用程序。以前整合第三方库需要配置很多,现在用Spring Boot应用程序只需要很少的Spring配置。一句话 简化繁琐的配置。
Spring Boot的开发环境
Spring Boot支持java 6以上(可能有问题) ,Spring Boot 1.5.7 需要java7,但是官方建议使用java8( java8还有一堆新特性 赶快安装java8吧 )
关于Maven Spring Boot需要Maven3.2以上,如不按上面的环境安装,未知的bug等着你。
Servlet containers方面(官方图片)
入手一个新框架,当然要从它的helloworld开始,步骤如下
1、pom中导入Spring Boot依赖
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.7.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
2、写代码
package hello;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;/*** @author shan* @time 创建时间:2017年9月14日 下午2:12:18**/@RestController@EnableAutoConfigurationpublic class SampleController { @RequestMapping("/") String home() { return "Hello World!"; } public static void main(String[] args) throws Exception { SpringApplication.run(SampleController.class, args); }}
3、在浏览器中输入网址 即可看到下面的结果,hello world成功!
阅读全文
0 0
- SpringBoot学习之hello world
- springboot之hello world搭建学习笔记
- SpringBoot笔记之Hello World
- springboot入门之hello world
- SpringBoot之Hello world篇
- SpringBoot之Hello World&热启动插件
- SpringBoot入门(一)之Hello World
- 一头扎进springboot之Hello World
- SpringBoot的 Hello World
- Ant学习之Hello World
- Jni学习之hello world
- python学习之--Hello World
- Bottle学习之hello world
- springboot开发 第一个案例之hello,world!
- gradle, springboot,cfx-- Hello World
- SpringBoot入门:Hello World(一)
- SpringBoot框架搭建 Hello World
- SpringBoot入门系列:Hello World
- [Mysql] 防御和检查SQL注入攻击的手段
- 机器学习之K-means聚类算法
- AngularJS ui.bootstrap.alert 消息
- Spring学习(三):初探Spring容器
- 我的递归总结
- SpringBoot学习之hello world
- HDU 6045 推公式
- 进 程 控 制
- 南阳理工学院acm 水池问题 自己的理解
- 面向对象
- JavaScript基础学习(一)
- 批量删除(特殊)
- NYOJ 237 游戏高手的烦恼 (最小点覆盖)
- 最全Pycharm教程(34)——Pycharm内置终端以及远程SSH工具的使用