This blog is to undertake on a "taught you how to build SpringCloud entry item (b) with IDEA", unclear please go to my blog space and then look to see this blog, the above two blog successfully created a simple SpringCloud project, this blog is the main part of the project posted the code to allow readers to better combat operations SpringCloud project to build one of their own
1) substantially follows the framework of the project
2) eureka-server based program startup module
3) the properties file into yml types of document, and editing the configuration file as follows
application.yml file editing as follows:
4) Start the registry service, the console output to see this information, it indicates registry service starts successfully
5) After the registry service starts, enter the address in the browser: http: // localhost: 8761 /, you should see this screen, where you can see some of the service registered in the registry
6) Service Provider service-provider modules other codes follows
Here only provides a RestApi interface services, followed by a service consumer invokes this test API services:
HelloWorldController.java
Start this module
Then refresh the registry address HTTP: // localhost: 8761 / , you can see that he has been registered to the registration center
7) Consumer Services Other service-consumer module code is as follows:
ServiceConsumerApplication.java
service-consumer application.yml module are as follows:
Other codes are as follows:
HelloService.java
HelloControler.java
After starting the module, success is as follows:
Refresh Registration Center Address: HTTP: // localhost: 8761 / , you can see a new service has been registered with the registry
Open your browser and enter the address in a new window: HTTP: // localhost: 8764 / ADMIN hi name =? , If successful, it returns the following information indicates a successful call to the service provider's service interface (depending on the port can know, 8763 port is the port service providers)
This blog so far, any questions please leave a message with everyone to discuss learning, encourage each other gentlemen!