Preface: distributed architecture and micro-service concept
1.SOA concept (idea)
SOA: namely Service Oriented Architecture, Service-Oriented Architecture
Proposition:
The project modules split from a single architecture out of a can package into a long-distance call services in order to achieve a distributed architecture.
The development of each specific service, use a service interface definition of this function, and this is what we often say that the exposed interface.
When we realized the interface, the interface will be exposed to the network, you can remotely call, you can say that this service is developed, and this is what we often say "write interface."
SOA essence: to achieve a distributed architecture by providing services and calls to the service.
Project -----> module -------> Code
2. micro service micro-service concept
Micro-services and services advocated "miniaturized", the extracted service modules duplication of functionality encapsulated into micro-services, known as micro service assembly of each module. Function module and then make up the project.
Project -----> module -----> ----- Micro Services> Code
3. The relationship between SpringCloud and SpringBoot
This is a set of micro-services concept implementation.
SpringBoot the development of a specific service on a micro-micro.
SpringCloud unified management at the macro, micro coordinate the various services. Provide various services to the micro-service registration center, a gateway, distribution center, load balancing, fusing mechanism, service degradation, service monitoring, service details screen and so on.
4.SpringCloud and contrast Dubbo
- The most important difference:
Dubbo: the underlying RPC call
SpringCloud: underlying REST call (HTTP)
SpringCloud able to provide a complete solution directly to the project structure.
Dubbo only as the core and foundation of infrastructure projects and complete project-based solutions also need the help of other technologies.
Use 5.SpringBoot project
- Join the needed scene starter dependence
- Configuration properties or yml
- Create a master class start
- Open the related function by annotating
- Run the main startup class
6.HelloWorld
6.1 Procedure
① create Maven project
② adding dependence
③ create a master class start
④ create HelloHandler
⑤ start
Run main method in class master boot program to start SpringBoot.
⑥ access handler methods through the web
Extended: questions about the package scans
SpringBoot main sub-packet starts automatically scans the class is the class of the packet, corresponds xml configuration file <mvc: context scan = "package scan path" />
-
Implicit default statement automatically lead pack
NOTE: to be scanned in the sub-packet of the packet must be the master boot class.
-
Manual scanning package
Use annotations for packet
Access results:
6.2 Creating SpringBoot project by Spring plug
Restrictions: Each time you create networking projects must: must aid of Spring plug
Effect : Automatic primary initiator and application.properties, and the test class