(八)Java B2B2C多用户商城 springcloud架构- commonservice-eureka 项目构建过程

news/2023/11/30 22:34:39

我们针对于HongHu cloud的eureka项目做以下构建,整个构建的过程很简单,我会将每一步都构建过程记录下来,希望可以帮助到大家:

  1. 创建一个名为particle-common-eureka的maven项目,继承particle-commonservice,具体的pom.xml配置文件如下:
<?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>  
  1. 在启动类入口引用eureka的相关配置,代码如下:
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);  
    }  
}  
  1. 配置application.yml文件
# server (eureka 默认端口为:8761)  
server:  
  port: 8761  
# spring  
spring:  
  application:  
    name: particle-commonservice-erueka  
# eureka  
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  
  #设置清理无效节点的时间间隔,默认60000,即是60s  
    eviction-interval-timer-in-ms: 60000  
# 服务认证  
security:   
  basic:   
    enabled: true  
  user:   
    name: honghu  
    password: 123456  
management:  
  security:  
    enabled: false
  1. 增加项目的log机制和打包运行机制(后面我们会详细编写针对于Linux Centos下的打包部署机制)
  2. 自此整个项目部署完成,通过手动方式进行Run As --> Spring Boot App,运行结果如下:

控制台运行结果:

clipboard.png

访问控制台并登陆:

clipboard.png

控制台运行效果:

clipboard.png

clipboard.png

从现在开始,我这边会将近期研发的spring cloud微服务云架构的搭建过程和精髓记录下来,帮助更多有兴趣研发spring cloud框架的朋友,大家来一起探讨spring cloud架构的搭建过程及如何运用于企业项目。Spring Cloud大型企业分布式微服务云构建的B2B2C电子商务平台源码请加企鹅求求: 一零叁八七七四六贰六


http://www.niftyadmin.cn/n/2246217.html

相关文章

【评分卡】评分卡入门与创建原则——分箱、WOE、IV、分值分配

本文主要讲“变量选择”“模型开发”“评分卡创建和刻度” 变量分析 首先&#xff0c;需要确定变量之间是否存在共线性&#xff0c;若存在高度相关性&#xff0c;只需保存最稳定、预测能力最高的那个。需要通过 VIF(variance inflation factor&#xff09;也就是 方差膨胀因子…

CF-631-.Interview-水题

A.Interview Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 631A Description Blake is a CEO of a large company called “Blake Technologies”. He loves his company very much and he thinks th…

ntp多台主机时间同步

通俗的讲&#xff0c;多台主机ntp时间同步&#xff0c;就是自定义集群中一台机器&#xff08;我们这里叫它server&#xff09;与网络时间同步&#xff0c;然后其它主机与server主机时间同步 另外&#xff0c;ntp时间同步机制不是我们想象的那样直接同步&#xff0c;而是“逐渐”…

5G已来,5G精品系列课免费送?

5G不再只是从2G.txt到3G.jpg再到4G.avi的网络速率的提升&#xff0c;而是将人与人之间的通信扩展到万物互联&#xff0c;打造全移动和全连接的数字化社会。 众所周知&#xff0c;2018年6月中旬&#xff0c;3GPP全会批准通过了5G NR独立组网(SA)规范标准。全球各电信厂商和运营商…

Java大数简单题---Yet another A + B

PracticeGym 100735I Description Statements You are given three numbers. Is there a way to replace variables A, B and C with these numbers so the equality A  B  C is correct? Input There are three numbers X1, X2 and X3 (1 ≤ Xi ≤ 10100), each…

Cisco HyperFlex 多区域上联(Disjoint Networks Upstream)

Cisco HyperFlex 多区域上联&#xff08;Disjoint Networks Upstream&#xff09;Deploy Layer 2 Disjoint Networks Upstream in End Host Mode for HyperFlex一般意义上的HX平台是部署在大二层环境中&#xff0c;不同vlan跑不同的功能&#xff08;data&#xff0c;mgt&#x…

Restore 数学题,水题(转)

C - Restore Time Limit:25000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice Gym 100735E Description standard input/output Statements Given a matrix A of size N * N. The rows are numbered from 0 to N-1, the column…

unity实战 手机屏幕适配

使用背景 为了在UI中使用特效层&#xff0c;项目Canvas采用了Screen Space-Camera类型 UI的Scale Mode 选择的是Scale With Screen Size 的Expand&#xff0c;画布大小填的是1334, 750 在该选择下&#xff0c;会自动根据分辨率适配宽度/高度。 自动适配的规则是&#xff1a; 屏…

八皇后问题---递归回溯

每次需要满足的条件&#xff1a;abs(x[j]-x[k])abs(j-k) || x[j]x[k] #include <iostream> #include <cmath> using namespace std; const int num8; int sum0; int x[num]{0}; bool place (int k) {for(int j1;j<k;j){if(abs(x[j]-x[k])abs(j-k)||x[j]x[k])re…

容器监控实践—cAdvisor

概述 为了解决docker stats的问题(存储、展示)&#xff0c;谷歌开源的cadvisor诞生了&#xff0c;cadvisor不仅可以搜集一台机器上所有运行的容器信息&#xff0c;还提供基础查询界面和http接口&#xff0c;方便其他组件如Prometheus进行数据抓取&#xff0c;或者cadvisor inf…

染陌足迹——SeeConf2019

水文预警&#xff01;&#xff01;多图预警&#xff01;&#xff01; 听了一整天&#xff0c;每位讲师的演讲都十分精彩&#xff0c;每个主题都能给我从另一个角度的思考与启迪&#xff0c;大部分主题都是以未来的交互设计作为维度来展开思考与探讨&#xff0c;以故事或者事例的…

Java的四种线程池的使用,以及自定义线程工厂

四种线程池四种线程池分别是&#xff1a;newCachedThreadPool、newFixedThreadPool 、newScheduledThreadPool 和newSingleThreadExecutor &#xff0c;下面对这几个线程池一一讲解。newCachedThreadPool&#xff1a;可缓存的线程池源码&#xff1a;public static ExecutorServ…

30K iOS程序员的简述:如何快速进阶成为高级开发人员 ...

前言&#xff1a; 本篇文章适用于所有在这个行业已经有了几年时间后想要在职业生涯中取得突破的开发人员&#xff0c;编程人员和程序员&#xff08;或者你可能刚刚开始&#xff0c;但希望你能看到你的路径&#xff09; 本文适合那些有着简单愿望的人&#xff1a;你想成为一名高…

初涉Windows Mobile 5.0的开发(起步篇)[Teaks]

这个周末构建了Windows Mobile 5.0的开发环境&#xff0c;也简单测试了一下&#xff0c;算是起步吧&#xff0c;下面是简要步骤&#xff1a; 工欲善其事&#xff0c;必先利其器。首先安装工具 1. 安装Visual Studio 2005 2.开发工具包, 我下的是800多M的那个&#xff0c;Window…

用Kotlin写一个基于Spring Boot的RESTful服务

Spring太复杂了&#xff0c;配置这个东西简直就是浪费生命。尤其在没有什么并发压力&#xff0c;随便搞一个RESTful服务 让整个业务跑起来先的情况下&#xff0c;更是么有必要纠结在一堆的XML配置上。显然这么想的人是很多的&#xff0c;于是就 有了Spring Boot。又由于Java 8太…

(原創) array傳進function該怎麼寫才好? (.NET) (C#)

Abstract在C/C&#xff0c;array傳進function有很多技巧&#xff0c;但在C#&#xff0c;卻非常的單純&#xff0c;因為array自帶GetLength()&#xff0c;本篇主要是針對C/C做比較。 Introduction 1/**//* 2(C) OOMusou 2007 http://oomusou.cnblogs.com 3 4Filename : Arra…
最新文章