Browsed by
月份:2018年5月

Badge

Badge

[toc] 概述 OVERVIEW 标记是UI元素的一个小的状态描述。一个标记由一个小圆圈组成,通常包含一个数字或者其他短字母,并紧挨着其他的对象出现。 Badges are small status descriptors for UI elements. A badge consists of a small circle, typically containing a number or other short set of characters, that appears in proximity to another object. 标记位置 Badge position 默认标记的位置是above after。可通过定义matBadgePosition属性为above|below和before|after来改变方向。 By default, the badge will be placed above after. The direction can be changed by defining the attribute matBadgePosition follow by above|below and before|after. <mat-icon matBadge=”22″ matBadgePosition=”above after”>home</mat-icon> 也可以使用matBadgeOverlap来定义标记与其内部内容的交叠。通常你希望交叠的是图…

阅读全文 Read More

Bottom Sheet

Bottom Sheet

[toc] 概述 OVERVIEW MatBottomSheet可用于在屏幕底部打开Material Design面板。此面板主要用于移动设备的交互,可当作对话框或者菜单的备选方案。 The MatBottomSheet service can be used to open Material Design panels to the bottom of the screen. These panels are intended primarily as an interaction on mobile devices where they can be used as an alternative to dialogs and menus. 你可以通过调用open方法来打开一个底部菜单,加载一个组件与一个可选的配置对象。open方法将返回一个MatBottomSheetRef实例: You can open a bottom sheet by calling the open method with a component to be loaded and an optional config object. The open method will return an instance of MatBottomSheetRef: const bottomSheetRef = bottomSheet.open(SocialShareComponent, { ariaLabel: ‘Share on…

阅读全文 Read More

服务注册与发现

服务注册与发现

服务注册与发现 Service Registration and Discovery 通过此教程,你将构建并消费Netflix Eureka服务中心。 This guide walks you through the process of standing up and consuming the Netflix Eureka service registry. 将要做什么 What you’ll build 将设置一个Netflix Eureka服务中心并建立一个客户端,用来向中心注册自己与解析自己。一个服务中心是非常有用的,因为它可以启用客户端负载均衡并在不适用DNS的情况下解耦服务提供者与消费者。 You’ll setup a Netflix Eureka service registry and then build a client that both registers itself with the registry and uses it to resolve its own host. A service registry is useful because it enables client-side load-balancing and decouples service providers from consumers without the need for DNS. 需要些什么 What you’ll need 大约15分钟 你喜欢的文本编辑器或者IDE JDK 1.8或…

阅读全文 Read More

中心化配置

中心化配置

中心化配置 Centralized Configuration 此教程指导你构建一个Spring Cloud配置服务器,并从其中消费配置。 This guide walks you through the process of standing up, and consuming configuration from, the Spring Cloud Config Server 将要做什么 What you’ll build 你将构建一个配置服务器,然后建立一个客户端在启动时去消费配置并在不重启客户端的情况下刷新配置。 You’ll setup a Config Server and then build a client that consumes the configuration on startup and then refreshes the configuration without restarting the client. 需要些什么 What you’ll need 大约15分钟 你喜欢的文本编辑器或者IDE JDK 1.8或更高版本 Gradle 4+或者Maven 3.2+ 你也可以直接导入代码到IDE中: Spring Tool Suite (STS) IntelliJ IDEA About 15 minutes A favorite text editor or IDE JDK 1.8 or later Gradle 4+ or Maven 3.2+ You can a…

阅读全文 Read More

断路器

断路器

断路器 Circuit Breaker 此教程通过使用Netflix Hystrix容错库在可能失败的方法调用中应用断路器。 This guide walks you through the process of applying circuit breakers to potentially-failing method calls using the Netflix Hystrix fault tolerance library. 将要做什么 What you’ll build 你将使用一个断路器模式构建一个微服务应用,在方法调用失败时将降级服务。当一个相关的服务失败时,使用断路器模式将允许一个微服务继续执行,防止失败传递并让失败的服务有时间恢复。 You’ll build a microservice application that uses the Circuit Breaker pattern to gracefully degrade functionality when a method call fails. Use of the Circuit Breaker pattern can allow a microservice to continue operating when a related service fails, preventing the failure from cascading and giving the failing service time to …

阅读全文 Read More

使用Spring MVC提供Web内容

使用Spring MVC提供Web内容

使用Spring MVC提供Web内容 Serving Web Content with Spring MVC 你将通过此教程使用Spring创建一个”hello world”网站。 This guide walks you through the process of creating a “hello world” web site with Spring. 将要做什么 What you’ll build 你将构建一个拥有静态主页的应用,并且接收如下HTTP GET请求: You’ll build an application that has a static home page, and also will accept HTTP GET requests at: http://localhost:8080/greeting 然后会响应一个HTML网页。HTML的body包含一个问候: and respond with a web page displaying HTML. The body of the HTML contains a greeting: “Hello, World!” 也可以通过请求字符串的一个可选参数name来自定义问候: You can customize the greeting with an optional name parameter in the query string: http://localhost:…

阅读全文 Read More

构建一个RESTful Web服务

构建一个RESTful Web服务

构建一个RESTful Web服务 Building a RESTful Web Service 此教程将告诉你如何使用Spring创建一个”hello world”RESTful web服务。 This guide walks you through the process of creating a “hello world” RESTful web service with Spring. 将要做什么 What you’ll build 你将构建一个接受HTTP GET请求的服务: You’ll build a service that will accept HTTP GET requests at: http://localhost:8080/greeting 并返回表示问候的一个JSON响应。 and respond with a JSON representation of a greeting: {“id”:1,”content”:”Hello, World!”} 也可以通过备选参数name来自定义问候: You can customize the greeting with an optional name parameter in the query string: http://localhost:8080/greeting?name=User name参数将覆写并替代响应中默认的”World”: The …

阅读全文 Read More