Integrate spring Cloud cloud service architecture-Honghu Commonservice-eureka project build process

Source: Internet
Author: User

Now we build the following for the Eureka project of Honghu Cloud, the whole process is simple, I will record every step of the construction process, I hope to help you:

1. Create a MAVEN project named Particle-common-eureka, inheriting Particle-commonservice, with the following pom.xml configuration file:

<?xml version= "1.0"  encoding= "UTF-8"? ><project xmlns= "http://maven.apache.org/POM/ 4.0.0 " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation=" http://maven.apache.org/ Pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd "><modelVersion>4.0.0</modelVersion> <parent><groupid>com.ml.honghu</groupid><artifactid>particle-commonservice</ Artifactid><version>0.0.1-snapshot</version></parent><artifactid> Particle-commonservice-eureka</artifactid><packaging>jar</packaging><name> Particle-commonservice-eureka</name><description>particle-commonservice project for  Spring Boot</description><dependencies><dependency><groupId> Org.springframework.cloud</groupid><artifactid>spring-cloud-starter-eureka-server</artifactid ></dependency><dependency><groupid>org.springframework.boot</groupid><artifactid>spring-boot-starter-security</artifactid></dependency>< Dependency><groupid>org.springframework.boot</groupid><artifactid>spring-boot-devtools </artifactid></dependency><dependency><groupid>org.springframework.boot</groupid ><artifactid>spring-boot-starter-test</artifactid><scope>test</scope></ Dependency></dependencies><build><plugins><plugin><groupid> org.springframework.boot</groupid><artifactid>spring-boot-maven-plugin</artifactid>< Executions><execution><id>1</id><goals><goal>repackage</goal></goals ></execution>                 <execution>                 <id>2</id>                    < goals>                         <goal>build-info</goal>                     </goals>                 </execution ></executions><configuration><executable>true</executable></configuration> </plugin></plugins></build></project>

2. In the Boot class entry reference Eureka configuration, the code is as follows:

Package Com.ml.honghu;import Org.springframework.boot.springapplication;import Org.springframework.boot.autoconfigure.springbootapplication;import Org.springframework.cloud.netflix.eureka.server.enableeurekaserver;@[email protected] class Serviceapplication { public static void Main (string[] args) {Springapplication.run (serviceapplication.class, args);}}

3. Configuring the Application.yml file

# server  (eureka  default port is: 8761) server:  port: 8761# springspring:   application:    name: particle-commonservice-erueka# eurekaeureka:    client:     #  is registered to Eureka    register-with-eureka:  true    #  whether to obtain registration information from Eureka     fetch-registry: false     availability-zones:       honghu: honghuzone     service-url:       honghuzone: http://honghu:[ Email protected]:8761/eureka/      defaultzone: http://honghu:[email  protected]:8761/eureka/  instance:    prefer-ip-address: true     hostname: localhost    metadataMap:       zone: honghuzone&nBsp;     user: ${security.user.name}      password : {security.user.password}        #  designated Environment    environment: dev   #指定数据中心   datacenter: honghu  #  turn off self-protection mode    server:     enable-self-preservation: false   #设置清理无效节点的时间间隔, Default 60000, which is 60s    eviction-interval-timer-in-ms: 60000#  service authentication security:    basic:     enabled: true  user:      name: honghu    password: 123456management:  security:     enabled: false

4. Add the log mechanism of the project and the package operation mechanism (we will write the package deployment mechanism for Linux CentOS in detail later)

5. From the completion of this entire project deployment, the run as-to-Spring Boot App is performed manually with the following results:

Console Run Results:

650) this.width=650; "height=" 467 "src=" https://static.oschina.net/uploads/space/2017/1013/001736_uTN0_3613013. PNG "width=" "style=" Border:none;margin:auto;height:auto; "alt=" 001736_utn0_3613013.png "/>

To access the console and log in:

650) this.width=650; "height=" 456 "src=" https://static.oschina.net/uploads/space/2017/1013/001437_H4t9_3613013. PNG "width=" "style=" Border:none;margin:auto;height:auto; "alt=" 001437_h4t9_3613013.png "/>

Console Run Effect:

650) this.width=650; "height=" 873 "src=" https://static.oschina.net/uploads/space/2017/1013/001839_kvNs_3613013. PNG "width=" "style=" Border:none;margin:auto;height:auto; "alt=" 001839_kvns_3613013.png "/>

650) this.width=650; "height=" 781 "src=" https://static.oschina.net/uploads/space/2017/1013/001907_BqQr_3613013. PNG "width=" "style=" Border:none;margin:auto;height:auto; "alt=" 001907_bqqr_3613013.png "/>

from now on, my side will be developing a recent Springcloud the process and essence of micro-service cloud architecture is documented to help more interested in developing Spring Cloud frame of friends, hope can help more good scholars. let's explore how the Spring Cloud architecture is built and how it can be used in the industry. Source of information source

Integrate spring Cloud cloud service architecture-Honghu Commonservice-eureka project build process

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.