Skip to content

Conversation

DeanLee2013
Copy link
Contributor

No description provided.

* spring-boot-starter-configuration

接入配置中心。当需要在Spring BootSpring Cloud应用中,使用配置中心作为动态配置管理工具的时候,需要依赖。
Access the configuration center. When you need to use the Configuration Center as a dynamic configuration management tool in Spring Boot and Spring Cloud applications, you need to rely on it.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rely -> depend

* spring-boot-starter-provider

在Spring Boot中通过@EnableServiceComb启用java chassis的核心功能。这个功能可以用于“JAVA应用方式”和”Web开发方式“。 在”Web开发方式”中,通过spring.main.web-environment=false禁用了Web环境。因此,这个模块主要是解决”JAVA应用方式“的问题。
Enable the core functionality of java chassis via @EnableServiceComb in Spring Boot. This feature can be used for "JAVA application mode" and "Web development mode". In the "Web development method", the web environment is disabled by spring.main.web-environment=false. Therefore, this module is mainly to solve the problem of "JAVA application mode".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Web development method -> Web development mode


在Spring Boot中通过@EnableServiceComb启用java chassis的核心功能,并启用java chassis的RestServlet。用于” Web开发方式“。

Enable the core functionality of the java chassis via @EnableServiceComb in Spring Boot and enable the RestServlet for the java chassis. Used in "Web development methods".

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Web development methods -> Web development mode

@@ -1,2 +1 @@
两种开发方式都会启用java chassis的全量功能,JAVA应用方式运行于独立的HTTP服务器(基于vert.x构建)上,性能上存在很大的优势。Web开发方式运行于Tomcat或者其他内置的Web服务器之上,作为一个Servlet接收请求,因此在开发过程中,可以使用Web容器提供的一些功能,比如提供页面服务,使用Filter等。当应用只需要提供REST服务,并且对性能要求很高的场景,建议使用JAVA应用方式。

Both development methods will enable the full functionality of the java chassis. The JAVA application mode runs on a separate HTTP server (based on vert.x build), which has great advantages in performance. The web development method runs on Tomcat or other built-in web servers and receives requests as a servlet. Therefore, during the development process, you can use some functions provided by the web container, such as providing page services and using Filter. When the application only needs to provide REST services, and performance requirements are high, it is recommended to use a JAVA application.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

去掉build
JAVA application - JAVA application mode

Public void postData(@RequestBody Object data)
// Interface definition
Public void postData(@RequestBody IPerson interfaceData)
// no generic type of the specified type

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no generic type of the specified type 这个难以理解,修改一下

For more information on java chassis support for data types, please refer to the "Supported Data Types" section.

* 常用标签支持
* Common label support

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

标签应该翻译为Annotation,不是label

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那中文应该是注解才对,这个需要改下。标签当然是label

@@ -1,12 +1,12 @@
使用JAVA方式集成,为Spring Boot应用增加了一个高效的HTTP服务器和REST开发框架。这种方式集成非常简单。只需要在项目中引入相关依赖,并且使用@EnableServiceComb标签即可。
Using JAVA integration, an efficient HTTP server and REST development framework has been added for Spring Boot applications. This way of integration is very simple. Just introduce the relevant dependencies into the project and use the @EnableServiceComb tag.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tag -> Annotation

* Configure microservices

通过microservice.yaml文件可以定制微服务的信息,包括应用名称、微服务名称、监听的地址和端口等。
The microservice.yaml file allows you to customize the microservice information, including the application name, microservice name, listener address and port.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

application name -> application id

@@ -1,29 +1,29 @@
Web开发方式和JAVA应用方式的开发步骤基本类似。
The development steps of the web development method and the JAVA application method are similar.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method -> mode



主要有如下区别:
There are mainly the following differences:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are mainly the following differences: 这句话有点奇怪?

* JAVA application is based on spring-boot-starter, and web development is based on spring-boot-starter-web.

* JAVA应用方式依赖spring-boot-starter-provider,而Web开发方式依赖spring-boot-starter-transport。spring-boot-starter-web已经携带了hibernate-validator,不需要额外依赖。
* JAVA application relies on spring-boot-starter-provider, while web development relies on spring-boot-starter-transport. Spring-boot-starter-web already carries hibernate-validator and does not require additional dependencies.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relies ->depend

来关闭org.springframework.web.servlet.DispatcherServlet,通过@EnableServiceComb会启用org.apache.servicecomb.transport.rest.servlet.RestServlet。虽然排除DispatcherServlet不是必须的,但是大多数场景一个微服务里面存在多个REST框架都不是很好的主意,会造成很多使用上的误解。

* 在microservice.yaml文件中通过配置项servicecomb.rest.servlet.urlPattern来指定RestServlet的URL根路径。并且配置项servicecomb.rest.address里面的监听端口,必须和tomcat监听的端口保持一致(默认是8080,可以通过application.yml中增加server.port修改)
To close org.springframework.web.servlet.DispatcherServlet, enable org.apache.servicecomb.transport.rest.servlet.RestServlet via @EnableServiceComb. Although it is not necessary to exclude the DispatcherServlet, it is not a good idea to have multiple REST frameworks in a microservice in most scenarios, which will cause many misunderstandings in use.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

misunderstandings -> confusion

@DeanLee2013
Copy link
Contributor Author

@zhengyangyong all done

@zhengyangyong
Copy link

please rebase and solve conflicts

1. Replace RestController with RestSchema

如果业务代码不是新开发,而是基于Spring MVC做的开发,现在java chassis基于做改造,还需要注意在禁用DispatcherServlet后,和其有关的功能特性将不再生效。
2. Need to display the declaration @RequestMapping
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare @RequestMapping explicitly.

1. 通过RestSchema替换RestController
You can see that the tags used are mostly the same as Spring MVC. But there are also a few different places, such as:

2. 需要显示声明@RequestMapping
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

显式声明

在下面的章节,还会详细介绍在Spring MVC模式下两者的区别。
If the business code is not a new development but based on the development of Spring MVC, now the java chassis is based on the transformation, but also need to pay attention to the disabling of the DispatcherServlet, and its related features will no longer take effect.

In the following sections, the differences between the two in Spring MVC mode are also detailed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the following sections, we'll introduce some details of the differences in Spring MVC mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the following sections, about web JAVA application mode and web development mode, we'll introduce some details of the differences in Spring MVC mode.

@DeanLee2013
Copy link
Contributor Author

all done

@WillemJiang WillemJiang merged commit 31e6c81 into apache:master Aug 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants