sofa-boot(1)helloworld项目
本示例参考:https://www.sofastack.tech/sofa-boot/docs/QuickStart
示例采用sofa-boot 3.1.1版本。
如下步骤:
1、进入https://start.spring.io/,生成web项目
一定要勾选下边的web依赖,否则无法启动,因为没有导入tomcat。而sofaboot2.3.1版本不存在这个问题。
生成例子程序:
2、pom.xml
将pom中的
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
替换为
<parent>
<groupId>com.alipay.sofa</groupId>
<artifactId>sofaboot-dependencies</artifactId>
<version>3.1.1</version>
</parent>
接着导入健康检查依赖
<!-- import SOFABoot Dependency healthcheck and infra -->
<dependency>
<groupId>com.alipay.sofa</groupId>
<artifactId>healthcheck-sofa-boot-starter</artifactId>
</dependency>
3、application.properties
# Application Name
spring.application.name=SOFABoot Demo
# logging path
logging.path=./logs
4、启动SofabootHelloworldApplication.java
...
Tomcat started on port(s): 8080 (http) with context path ''
...
5、查看
查看version
浏览器输入:http://localhost:8080/actuator/versions
[
{
"GroupId": "com.alipay.sofa",
"Doc-Url": "http://www.sofastack.tech/sofa-boot/docs/Home",
"ArtifactId": "healthcheck-sofa-boot-starter",
"Commit-Time": "2018-12-29T16:53:31+0800",
"Commit-Id": "fffd3b47c629cc02b944b11d8fe68684afdb7b9f",
"Version": "3.1.1",
"Build-Time": "2019-02-18T09:53:30+0800"
},
{
"GroupId": "com.alipay.sofa",
"Doc-Url": "http://www.sofastack.tech/sofa-boot/docs/Home",
"ArtifactId": "infra-sofa-boot-starter",
"Commit-Time": "2018-12-29T16:53:31+0800",
"Commit-Id": "fffd3b47c629cc02b944b11d8fe68684afdb7b9f",
"Version": "3.1.1",
"Build-Time": "2019-02-18T09:52:12+0800"
}
]
浏览器输入:http://localhost:8080/actuator/readiness
{
"status": "UP",
"details": {
"SOFABootReadinessHealthCheckInfo": {
"status": "UP"
},
"diskSpace": {
"status": "UP",
"details": {
"total": 78650093568,
"free": 6799233024,
"threshold": 10485760
}
}
}
}
日志:
sofa-boot(1)helloworld项目的更多相关文章
- SpringBoot快速创建HelloWorld项目
废话不多提,拿起键盘,打开 IDEA 就是一通骚操作. 打开 IDEA 后,首页选择 Create New Project,再接着按下图所示,快速搭建SpringBoot项目. 接下来将 Group ...
- IDEA 创建 Spring Boot 多模块项目(Multi Modules)
本准备写点代码实例放到网站,太多的模板,反而每次新建工程的时候很麻烦.于是准备把这个章节的内容提前先讲讲.正好把这个代码也管理起来.话说这个多模块功能还挺爽. 写过 C# 项目用过 Visual St ...
- struts2学习笔记--动手搭建环境+第一个helloworld项目
在Myeclipse中已经内置好了struts2的环境,但是为了更好的理解,这里自己从头搭建一下: 前期准备:下载struts2的完整包,下载地址:https://struts.apache.org/ ...
- (转)Android Studio系列教程一下载与安装 背景Android Studio VS Eclipse准备下载创建HelloWorld项目
背景 相信大家对Android Studio已经不陌生了,Android Studio是Google于2013 I/O大会针对Android开发推出的新的开发工具,目前很多开源项目都已经在采用,Goo ...
- Egret 学习之 从HelloWorld项目开始 (二)
1,创建新项目HelloWorld ,可以在界面上点击文件->新建,也可以在命令行使用create: 2,src 目录,存放我们的代码.我们编写的代码都放在src目录下面. bin-debug ...
- 跟着刚哥学习Spring框架--创建HelloWorld项目(一)
1.Spring框架简介 Spring是一个开源框架,Spring是在2003年兴起的一个轻量级的开源框架,由Rod johnson创建.主要对JavaBean的生命周期进行管理的轻量级框架,Spri ...
- 从零一起学Spring Boot之LayIM项目长成记(五)websocket
前言 距离上一篇已经比较久的时间了,项目也是开了个头.并且,由于网上的关于Spring Boot的websocket讲解也比较多.于是我采用了另外的一个通讯框架 t-io 来实现LayIM中的通讯功能 ...
- 从零一起学Spring Boot之LayIM项目长成记(四) Spring Boot JPA 深入了解
前言 本篇内容主要是一些关于JPA的常用的一些用法等.内容也是很多是看其他博客学来的,顺道在本系列博客里抽出一篇作为总结.下面让我们来看看吧. 不过我更推荐大家读本篇:https://lufficc. ...
- 从零一起学Spring Boot之LayIM项目长成记(三) 数据库的简单设计和JPA的简单使用。
前言 今天是第三篇了,上一篇简单模拟了数据,实现了LayIM页面的数据加载.那么今天呢就要用数据库的数据了.闲言少叙,书归正传,让我们开始吧. 数据库 之前有好多小伙伴问我数据库是怎么设计的.我个人用 ...
- Spring Boot 2.0系列文章(五):Spring Boot 2.0 项目源码结构预览
关注我 转载请务必注明原创地址为:http://www.54tianzhisheng.cn/2018/04/15/springboot2_code/ 项目结构 结构分析: Spring-boot-pr ...
随机推荐
- idea 修改Recent projects
idea用了一段时间了,打开的项目多了,导致Open Recent列表中的项目也非常多,在找一个项目时很不方便. 后来查询,在~/Library/Preferences/IntelliJIdea目录/ ...
- 友善之臂smart210 3G网卡配置说明
1.命令行输入 3g-ppp /etc/3g-modem/12d1.1446.12d1.1001 2.call-ppp wcdma 3. 你到etc目录里grep一下192.168.1.1 sant ...
- 高性能MySQL笔记-第5章Indexing for High Performance-001B-Tree indexes(B+Tree)
一. 1.什么是B-Tree indexes? The general idea of a B-Tree is that all the values are stored in order, and ...
- head first 设计模式 观察者模式
Head first 设计模式:定义了对象之间的一对多依赖,这样一来,当一个对象改变状态时,它的所有依赖者都会受到通知并自动更新. 让主题与观察者之间松耦合 大话设计模式:定义了一种一对多的依赖关 ...
- 使用IDEA编译spark 1.5并运行example的代码
操作系统:windows 10 IDEA : IDEA 14.1.4 1:使用IDEA导入spark 1.5的源码,注意maven配置为自动导入 2:在maven窗口下的profiles中勾选hado ...
- java全栈day13----Eclipse项目的jar包导出与使用jar包
01eclipse快捷键 Ctrl+T:查看所选中类的继承树 例如,在下面代码中,选中Teacher类名,然后按Ctrl+T,就会显示出Teacher类的继承关系 * B: 查看所选中方法的源代码 ...
- namespace/symbol/:keyword/::keyword in Clojure
此文已由作者张佃鹏授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 1.关键字(:keyword/::keyword): 最近在学习使用clojure.spec(验证数据的 ...
- Python3中实现简单的购物车程序
product_list = [ ('iphone',5800), ('imac',15800), ('watch',9800), ('cloth',550), ('coffe latee',35), ...
- Ubuntu - 安装hadoop(简约版)
相关版本: VMware ubuntuKylin16.04 JDK :openjdk Hadoop-2.9.1 步骤: 1.SSH 配置 [ 远程登陆 ] [ 配置SSH免码登陆 ] *测试:ssh ...
- 与HDFS交互-By shell命令
Shell命令的开头有三种: hadoop fs hadoop dfs hdfs dfs 关于具体命令之前写过 可查看:https://www.cnblogs.com/floakss/p/970344 ...