Springboot+springcloud Related Questions

Source: Internet
Author: User
Tags solr

What is Springbootused to simplify the initial construction of the spring application and the development process using a specific way to configure (properties or yml files)Create a separate spring reference program the Main method runsembedded Tomcat eliminates the need to deploy war filesSimplify maven configurationautomatic configuration spring add corresponding function starter Automation configuration                what are the common starter of springboot?Spring-boot-starter-web embedded in Tomcat and Web development requires servlet and JSP supportSPRING-BOOT-STARTER-DATA-JPA Database SupportSpring-boot-starter-data-redis Redis Database SupportSPRING-BOOT-STARTER-DATA-SOLR SOLR Supportmybatis-spring-boot-starter third-party MyBatis Integration starter        springboot principle of automatic configurationadd @springbootapplication or @enableautoconfiguration in the Spring program Main methodwill automatically go to Maven to read the Spring.factories file in each starter the file is configured with all the beans that need to be created in the spring containerSpringboot How to read a configuration filespringboot Default Read configuration file is application.properties or application.yml        Springboot Integration of MyBatis processAdd MyBatis starter maven dependency<dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>1.2.0</version></dependency>adding @mapper annotations to the MyBatis interfaceConfiguring data source information in Application.yml        Springboot How to add the "Modify code" automatic restart functionAdd developer Toolset =====spring-boot-devtools        What is Micro servicethe previous pattern was that all the code in the same project was deployed in the same server different modules of the same project have different functions to preempt each other's resourcesMicroServices will split the project into micro-service microservices based on different business rules to deploy on different machines to call each other on the serviceJava microservices Framework has Dubbo (can only be used to do microservices), Spring Cloud (provides service discovery, circuit breakers, etc.)        Springcloud How to achieve registration and discovery of servicesThe service registers the service with the registry (Eureka or zookeeper) by specifying the corresponding service name at the time of publication (the service name includes the IP address and port)This process is Springcloud automatic implementation only need to add @enabledisscoveryclient the same service modify port in the Main method to launch multiple instancesCall Method: Pass the service name through the registry to get all available instances of the service through the load Balancing policy call (ribbon and feign)Ribbon and Feign differencesThe ribbon adds Maven dependent Spring-starter-ribbon using @ribbonclient (value= "service name") to invoke the remote service corresponding method using Resttemplatefeign add maven dependent Spring-starter-feign service provider to provide external interface callers using @feignclient ("Specify Service Name") on the interfacethe difference between ribbon and feign:both the ribbon and the feign are used to invoke other services, but in different ways. 1. The annotations used by the start-up class are different, and the Ribbon is @ribbonclient,feign with @enablefeignclients. 2. Depending on the location of the service, the Ribbon is declared on the @ribbonclient annotation and feign is used in the interface that defines the abstract method @feignclient declaration. 3. In different ways, the ribbon needs to build its own HTTP request, simulate an HTTP request and then send it to other services using resttemplate, which is cumbersome. feign has been improved on the basis of the ribbon, using interfaces to define methods of other services that need to be invoked as abstract methods .You do not need to build your own HTTP requests. Note, however, that the annotations of the abstract method, the method signature, and the method of providing the service are exactly the same.         the role of the Springcloud circuit breakerWhen a service invokes another service because of a network cause or a problem with its own cause, the caller waits for the callee to respond more service requests to those resourcescause more requests to wait this will happen cascading effect (avalanche effect) circuit breaker is to solve this problemThe circuit Breaker has a fully open statea certain number of times can not be called and multiple detection of no recovery signs the circuit breaker is fully open, then the next request will not request to the serviceHalf OpenThere are signs of recovery in a short period of time. The circuit breaker will send a partial request to the service when the circuit breaker shuts down when it is normally calledCloseThe circuit breaker shuts down normally when the service is in a normal state

Springboot+springcloud Related Questions

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.