Before we build the project, let's take a look at the Eureka, which is an official explanation, and I'll look back at you for a moment:Service Discovery: Eureka ClientService discovery is one of the key principles of micro-service architecture. Trying to configure each client or some form of convention can be very difficult and very fragile. The Netflix service discovers that servers and clients are Eureka.
Summary: View:h5, Vue.js, Spring Tag, React, AngularJs spring boot/spring Cloud:zuul, Ribbon, feign, Turbine, Hystrix, Oauthor2, Sleuth, API Gateway, Spring Cloud, Config Eureka, SSO, Spring Cloud, BUS, Turbine, Zipkin, Cache, Spring Cloud Admin, API Gateway, ELK Spring Cloud Security, Spring
Spring cloud itself provides a lot of components, but we need to follow the business model of the enterprise to customize the common architecture required by the enterprise ...Below I have made the following technical summary for the spring Cloud Micro-service distributed cloud architecture, hoping to help you:View:H5,
service port is set to 3333, which is the configuration of the production environment (PROD)According to the above experiment, we can summarize the multi-environment configuration ideas as follows:Configure common content in application.properties and set Spring.profiles.active=dev to the default configuration of the development environmentConfigure different environments in Application-{profile}.propertiesActivating configuration of different enviro
/ honghuZone: http://honghu:[emailprotected]:8761/eureka/ registry-fetch-interval-seconds: 300 availability-zones: honghu: honghuZone instance: prefer-ip-address: true metadataMap: version: 1.0 variant: A user: ${security.user.name} password: ${security.user.password} management: security: Note: If you do not load the profile information from a remote git or svn library, you can configure the load local address, such as the configuration usin
Honghu Cloud is based on Springcloud, Spring cloud itself provides a lot of components, but we need to follow the business model to customize the enterprise needs of the common architecture, then we need to consider what technology to use now?Below I have made the following technical summary for the spring cloud MicroServices Distributed
Exception {MVC= Mockmvcbuilders.standalonesetup (NewHellocontroller ()). build (); } @Test Public voidGethello () throws Exception {Mvc.perform (mockmvcrequestbuilders.Get("/hello"). Accept (Mediatype.application_json)). Andexpect (Status (). IsOk ()). Andexpect (Content () .string(Equalto ("Hello World"))); } }
Use MockServletContext to build an empty one WebApplicationContext so that we can create HelloController it @Before and pass it to the function in the function MockMvcBuilders
(equalTo("Hello World"))); }}Use Mockservletcontext to build an empty webapplicationcontext, This allows the hellocontroller that we create to be created in the @before function and passed to the Mockmvcbuilders.standalonesetup () function.Note introduce the following to make the status, content, Equalto functions availableimport static org.hamcrest.Matchers.equalTo;import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;import static org.springframework.test.w
, throw MyException exception[Java] View plain copy@Controllerpublic class Hellocontroller {@RequestMapping("/json") public String json() throws MyException { throw new MyException("发生错误2"); } }Create a corresponding processing for a myexception exception[Java] View plain copy@ControllerAdvicepublic class Globalexceptionhandler {@ExceptionHandler(value = MyException.class) @ResponseBody public ErrorInfo}Launch app, Access: Http://localhost:8080/json, you can get the following return co
request = Get ("/users/"); Mvc.perform (Request) Andexpect (status () IsOk ()). Andexpect (Content (). String (Equalto (" [{\ "id\": 1,\ "name\": \ "Test master \", \ "age\": 20}])); 4, put modifies the user request with id 1 = put ("/users/1"). Param ("name", "Test Ultimate Master"). Para M ("Age", "30"); Mvc.perform (Request) Andexpect (content (). String (Equalto ("Success")); 5. Get a user request with id 1 = Get ("/USERS/1"); Mvc.perform (
First, review and elaborate on the @controller, @RestController, @RequestMapping annotations used in the QuickStart. If you are unfamiliar with spring MVC and have not yet tried a QuickStart case, it is recommended that you take a look at QuickStart content first.@Controller: Modifier class, used to create an object that handles HTTP requests@RestController: Note added after Spring4, the original return JSON in @controller need @ResponseBody to match, If you replace @controller directly with @re
velocity, freemarker, and so on. The main goal of Thymeleaf is to provide a well-formed template creation that can be properly displayed by the browser, so it can also be used as a static model. You can use it to create validated XML and HTML templates. Rather than writing logic or code, developers simply add tag attributes to the template. Next, these tag properties perform pre-established logic on the DOM (Document Object model).Sample Template:You can see that thymeleaf is mainly attributed
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.