Spring Cloud Cloud Service Architecture-Commonservice-eureka Project Process Building

Source: Internet
Author: User

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

Create a Maven project named Particle-common-eureka, which inherits the Particle-commonservice, and the specific pom.xml configuration file is as follows:

<?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> <dependenc Y> <groupId>org.springframework.cloud</groupId> <artifactid>spring-cloud-starter-eu   Reka-server</artifactid> </dependency> <dependency>       <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security< /artifactid> </dependency> <dependency> <groupid>org.springframework.boot</grou pid> <artifactId>spring-boot-devtools</artifactId> </dependency> <dependency&gt          ; <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> <execu tion> <id>1</id> <goals> <goal& Gt;repackage</goal&gT </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;@EnableEurekaServer @SpringBootApplication public 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 # Spring SPRING:APPLICATION:NAME:PARTICLE-COMMONSERVICE-E Rueka # Eureka Eureka:client: # Whether to register to Eureka Register-with-eureka:true # whether to get 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 User: ${SECURITY.USER.N AME} password: {security.user.password} # Specify Environment Environment:dev #指定数据中心 Datacenter:honghu # Turn off self-protection mode Type Server:enable-self-preservation:false #设置清理无效节点的时间间隔, default 60000, which is 60s eviction-interval-timer-in-ms:600 00 # Service Certification security:basic:enabled:true User:name:honghu password:123456 management:sec Urity:enabled:falSe   

Increase the log mechanism and package run mechanism of the project (we will write the package deployment mechanism for Linux CentOS in detail later)
The run as-to-Spring Boot App is done manually from this entire project deployment.

Spring Cloud Cloud Service Architecture-Commonservice-eureka Project Process Building

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.