谷歌云Spring Boot & Spring Cloud

Building Scalable Java Microservices with Spring Boot and Spring Cloud学习笔记

Week 1

GCP services overview

在这里插入图片描述

  • Cloud Function: provide a completely serverless execution environment or functions as a service
  • App engine: that provides a fully managed platform as a service framework.
  • Kubernetes engine: that provides a managed containers as a service environment for containerized applications.
  • Compute Engine: which is Google’s infrastructure as a service solution that provides maximum flexibility for users and organizations who choose to manage their solutions themselves.
    在这里插入图片描述
    Migrate from using a Cloud SQL instance to a Cloud Spanner instance to meet the needs for high levels of transactional performance.
    在这里插入图片描述

Spring Framework Intro

Spring framework: an open source application framework and inversion of control container developed by Pivotal for the Java platform.
Spring boot: a spring framework solution designed to simplify the bootstrapping and development of stand-alone production spring based applications.

Week 2

Lab 1: Bootstrapping the application frontend and backend

Cloudshell is an interactive Linux command line shell environment for managing resources hosted on GCP. When you start Cloudshell, it provisions a small compute engine virtual machine, running a Debian-based Linux operating system. Cloud Shell provides command line access to the virtual machine instance in a terminal window that opens in the GCP console.
Lab Link

Objectives
In this lab, you learn how to perform the following tasks:

  • Configure Cloud Shell to run a multi-part Java application locally
  • Use Apache Maven to launch Java applications in Cloud Shell
  • Use curl and the Cloud Shell web preview to test connectivity to web applications running locally in Cloud Shell

Task 1. Bootstrap the application

  1. Run the backend locally
    Run the backend application (guestbook-service).
cd ~/guestbook-service
./mvnw -q spring-boot:run -Dserver.port=8081
	Test the service
curl http://localhost:8081/guestbookMessages
	Post a new message.
curl -XPOST -H "content-type: application/json" \
  -d '{"name": "Ray", "message": "Hello"}' \
  http://localhost:8081/guestbookMessages
	List all the messages.
curl http://localhost:8081/guestbookMessages
  1. Run the frontend locally
    Make a copy of the initial version of the frontend application (guestbook-frontend).
cp -a ~/spring-cloud-gcp-guestbook/1-bootstrap/guestbook-frontend \
  ~/guestbook-frontend

Run the frontend application.

cd ~/guestbook-frontend
./mvnw -q spring-boot:run

Task 2. Test the guestbook application

  1. Web preview on port 8080

  2. Use Cloud Shell to test the backend service
    List all the calls to backend guestbook-service API

curl -s http://localhost:8081/guestbookMessages
  1. Use jp to parse the JSON return text in given format.
curl -s http://localhost:8081/guestbookMessages \
  | jq -r '._embedded.guestbookMessages[] | {name: .name, message: .message}'

Spring Boot注解

SpringBoot之常用注解

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值