**我们针对于HongHu cloud的eureka项目做以下构建,整个构建的过程很简单,我会将每一步都构建过程记录下来,希望可以帮助到大家:
Xml代码 收藏代码
<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>
Java代码 收藏代码
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);
}
}
spring:
application:
name: particle-commonservice-erueka
eureka:
client:
# 是否注册到eureka
register-with-eureka: true
# 是否从eureka获取注册信息
fetch-registry: false
availability-zones:
honghu: honghuZone
service-url:
honghuZone: http://honghu:123456@localhost:8761/eureka/
defaultZone: http://honghu:123456@localhost:8761/eureka/
instance:
prefer-ip-address: true
hostname: localhost
metadataMap:
zone: honghuZone
user: ${security.user.name}
password: {security.user.password}
environment: dev
datacenter: honghu
server:
enable-self-preservation: false
eviction-interval-timer-in-ms: 60000
security:
basic:
enabled: true
user:
name: honghu
password: 123456
management:
security:
enabled: false
访问控制台并登陆:
控制台运行效果:
从现在开始,我这边会将近期研发的spring cloud微服务云架构的搭建过程和精髓记录下来,帮助更多有兴趣研发spring cloud框架的朋友,大家来一起探讨spring cloud架构的搭建过程及如何运用于企业项目。源码来源
Spring Cloud是一系列框架的有序集合。利用Spring Boot的开发模式简化了分布式系统基础设施的开发,如服务发现、注册、配置中心、消息总线、负载均衡、断路器、数据监控等(这里只简单的列了一部分),都可以用Spring Bo...
本篇我们根据架构图进行代码的构建。根据微服务化设计思想,结合spring cloud本身的服务发现、治理、配置化管理、分布式等项目优秀解决方案,我们使用Maven技术将框架进行模块化、服务化、原子化封装,也为后期的热插拔、持续集成做一些...
上一篇我们介绍了spring cloud云服务架构 - particle云架构代码结构,简单的按照几个大的部分去构建代码模块,让我们来回顾一下: 第一部分: 针对于普通服务的基础框架封装(entity、dao、service、co...
读者评论