【Spring Boot 】1、Spring Boot 开始
0、写在最前面:
开始了新的征程,Spring Boot作为下一代的t开发框架,日渐流行。它作为spring mvc 的继承者,虽然二者之间没有多大联系,但是Spring Boot
的出现,大大简化了开发中的各种配置,功能相比Spring MVC,更加的0配置,代码更佳简洁,所有需要的插件都可以类似于模块化的在pom.xml中直接引入。
开发工具:
IDE:IntelliJ IDEA 2017.1
开发环境:
1 、入门Demo
idea 的入门demo,手写一个Controller。
package com.samuel.girl; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; @RestController
public class HelloController { @RequestMapping(value = "/hello",method = RequestMethod.GET)
public String sayHello(){ return "Hello,Spring Boot!";
}
}
启动项目,在浏览器中输入:http://localhost:8080/hello,
就可以打印出:Hello,Spring Boot!
2、Spring Boot的项目启动方式:
2.1、启动方式1:
IntelliJ IDEA的自带启动方式,在
@SpringBootApplication
public class GirlApplication { public static void main(String[] args) {
SpringApplication.run(GirlApplication.class, args);
}
}
右键运行即可,
2.2、启动方式2
用命令行启动 ,
命令切到项目所在的目录,比如我的
:~ sam$ cd /Volumes/mac-backup/dev/spring-boot/
运行命令:
:spring-boot sam$ mvn spring-boot:run
就已经启动了:
2.3、启动方式3
##先编译下
mvn install
这个时候会在target目录下生成一个jar文件:girl-0.0.1-SNAPSHOT.jar,用java启动这个文件,即可运行
运行命令:
:target sam$ java -jar girl-0.0.-SNAPSHOT.jar
结尾
这个就是spring boot的第一个随笔了,后面会吧spring boot 的配置,注释分开写一写,
代码丢在码云上面:
【Spring Boot 】1、Spring Boot 开始的更多相关文章
- 一:Spring Boot、Spring Cloud
上次写了一篇文章叫Spring Cloud在国内中小型公司能用起来吗?介绍了Spring Cloud是否能在中小公司使用起来,这篇文章是它的姊妹篇.其实我们在这条路上已经走了一年多,从16年初到现在. ...
- Spring Kafka和Spring Boot整合实现消息发送与消费简单案例
本文主要分享下Spring Boot和Spring Kafka如何配置整合,实现发送和接收来自Spring Kafka的消息. 先前我已经分享了Kafka的基本介绍与集群环境搭建方法.关于Kafka的 ...
- 使用Spring Session实现Spring Boot水平扩展
小编说:本文使用Spring Session实现了Spring Boot水平扩展,每个Spring Boot应用与其他水平扩展的Spring Boot一样,都能处理用户请求.如果宕机,Nginx会将请 ...
- 一起来学spring Cloud | 第一章:spring Cloud 与Spring Boot
目前大家都在说微服务,其实微服务不是一个名字,是一个架构的概念,大家现在使用的基于RPC框架(dubbo.thrift等)架构其实也能算作一种微服务架构. 目前越来越多的公司开始使用微服务架构,所以在 ...
- Spring,Spring MVC及Spring Boot区别
什么是Spring?它解决了什么问题? 我们说到Spring,一般指代的是Spring Framework,它是一个开源的应用程序框架,提供了一个简易的开发方式,通过这种开发方式,将避免那些可能致使代 ...
- 基于Spring Boot、Spring Cloud、Docker的微服务系统架构实践
由于最近公司业务需要,需要搭建基于Spring Cloud的微服务系统.遍访各大搜索引擎,发现国内资料少之又少,也难怪,国内Dubbo正统治着天下.但是,一个技术总有它的瓶颈,Dubbo也有它捉襟见肘 ...
- Spring Cloud Alibaba与Spring Boot、Spring Cloud之间不得不说的版本关系
这篇博文是临时增加出来的内容,主要是由于最近连载<Spring Cloud Alibaba基础教程>系列的时候,碰到读者咨询的大量问题中存在一个比较普遍的问题:版本的选择.其实这类问题,在 ...
- Spring Cloud和Spring Boot的区别
Spring MVC: Spring MVC属于SpringFrameWork的后续产品,已经融合在Spring Web Flow里面.Spring 框架提供了构建 Web 应用程序的全功能 MVC ...
- maven 聚合工程 用spring boot 搭建 spring cloud 微服务 模块式开发项目
项目的简单介绍: 项目采用maven聚合工程 用spring boot 搭建 spring cloud的微服务 模块式开发 项目的截图: 搭建开始: 能上图 我少打字 1.首先搭建maven的聚合工程 ...
- Spring Boot(Spring的自动整合框架)
Spring Boot 是一套基于Spring框架的微服务框架,由于Spring是一个轻量级的企业开发框架,主要功能就是用于整合和管理其他框架,想法是将平时主流使用到的框架的整合配置预先写好,然后通过 ...
随机推荐
- Notification API,为你的网页添加桌面通知推送
Notification 是什么 MDN: Notifications API 的 Notification 接口用于配置和向用户显示桌面通知.这些通知的外观和特定功能因平台而异,但通常它们提供了一种 ...
- ES[7.6.x]学习笔记(九)搜索
搜索是ES最最核心的内容,没有之一.前面章节的内容,索引.动态映射.分词器等都是铺垫,最重要的就是最后点击搜索这一下.下面我们就看看点击搜索这一下的背后,都做了哪些事情. 分数(score) ES的搜 ...
- Asp.net MVC验证那些事(1)-- 介绍和验证规则使用----[转]--[并修改了部分内容]
Asp.net MVC验证那些事(1)-- 介绍和验证规则使用 -----原文地址链接 数据的有效性验证,是程序开发中必不可少的环节.这篇文章,我们将用一个实例来说明如何在MVC中使用Validati ...
- Java集合--阻塞队列及各种实现的解析
阻塞队列(Blocking Queue) 一.队列的定义 说的阻塞队列,就先了解下什么是队列,队列也是一种特殊的线性表结构,在线性表的基础上加了一条限制:那就是一端入队列,一端出队列,且需要遵循FIF ...
- Java——关键字instanceof
instanceof 判断一个对象是否为一个类的实例,是为true ,否为false class Animal{} class Cat extends Animal{} /**instanceof 判 ...
- SqlServer2008查询性能优化_第一章
- Linux系统部署JavaWeb项目(超详细tomcat,nginx,mysql)
转载自:Linux系统部署JavaWeb项目(超详细tomcat,nginx,mysql) 我的系统是阿里云的,香港的系统,本人选择的是系统镜像:CentOS 7.3 64位. 具体步骤: 配置Jav ...
- Shell概述1
Shell概述1 脚本文件内容(vim ex2) #!/bin/bash #If no arguments,then listing the current directory. #Otherwise ...
- Parrot os安装docker及docker-compose
一.安装docker 1.添加Docker pgp key curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key ...
- Rocket - debug - TLDebugModuleInner - Hart Bus Access
https://mp.weixin.qq.com/s/deNMEyJ1idJDVoZwwo0A1A 简单介绍TLDebugModuleInner中核心总线访问(Hart Bus Access). 参考 ...