Building a standalone version of Eureka Server

Source: Internet
Author: User

1. Use the spring website to generate the template project, https://start.spring.io/,spring Cloud version edgware.sr4,spring boot version 1.5.16

2. Modify the project's Pom file
<?XML version= "1.0" encoding= "UTF-8"?><Projectxmlns= "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>    <groupId>Com.example</groupId>    <Artifactid>Eurekaserver</Artifactid>    <version>0.0.1-snapshot</version>    <Packaging>Jar</Packaging>    <name>Eurekaserver</name>    <Description>Demo Project for Spring Boot</Description>    <Parent>        <groupId>Org.springframework.boot</groupId>        <Artifactid>Spring-boot-starter-parent</Artifactid>        <version>1.5.16.RELEASE</version>        <RelativePath/> <!--Lookup parent from repository -    </Parent>    <Properties>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>        <java.version>1.8</java.version>    </Properties>    <dependencymanagement>        <Dependencies>            <Dependency>                <groupId>Org.springframework.cloud</groupId>                <Artifactid>Spring-cloud-dependencies</Artifactid>                <version>Edgware.sr4</version>                <type>Pom</type>                <Scope>Import</Scope>            </Dependency>        </Dependencies>    </dependencymanagement>    <Dependencies>        <Dependency>            <groupId>Org.springframework.boot</groupId>            <Artifactid>Spring-boot-starter-web</Artifactid>        </Dependency>        <Dependency>            <groupId>Org.springframework.boot</groupId>            <Artifactid>Spring-boot-starter-test</Artifactid>            <Scope>Test</Scope>        </Dependency>        <!--Spring Cloud Default configuration Launcher -        <Dependency>            <groupId>Org.springframework.cloud</groupId>            <Artifactid>Spring-cloud-starter-config</Artifactid>        </Dependency>        <!--Spring Cloud Eureka Server launcher -        <Dependency>            <groupId>Org.springframework.cloud</groupId>            <Artifactid>Spring-cloud-starter-eureka-server</Artifactid>        </Dependency>    </Dependencies>    <Build>        <Plugins>            <plugin>                <groupId>Org.springframework.boot</groupId>                <Artifactid>Spring-boot-maven-plugin</Artifactid>            </plugin>        </Plugins>    </Build></Project>
3. Modify the global configuration file application.properties
Eclipse installs the properties Editor, you can add Chinese annotations in the Eclipse "Help", "Install New software." "Opens the wizard for installing the plugin to enter the address,
http://propedit.sourceforge.jp/eclipse/updates/Wait a moment, select the properties editor and restart it after installation.
# Set up Spring app naming, customizable, non-essential spring.application.name=eureka-server# set up Eureka Server Web console port, Custom Server.port=8761#是否将自己注册到Eureka-in server, the default is Trueeureka.client.registerWithEureka= false Get Service registration information in #是否从Eureka-server, default = Trueeureka.client.fetchRegistry=false
4. Start class Add @enableeurekaserver annotationsto openEureka ServerService
@EnableEurekaServer @springbootapplication  Public class eurekaserverapplication {    publicstaticvoid  main (string[] args) {        Springapplication.run (eurekaserverapplication. class , args);}    }
5.AccessEureka Server WEBControl Deskhttp//localhost:8761/Solve the problem
After the startup class added @enableeurekaserver annotations, prompted Enableeurekaserver cannot is resolved to a type, find online problems can not be resolved, then delete the MAVEN library in the Boot and Cloud folder, Re-update the library problem resolution, cause JAR pack issue

Building a standalone version of Eureka Server

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.