zoukankan      html  css  js  c++  java
  • 在eclipse中使用maven构建spring cloud微服务

    工具/原料

    • eclipse
    • maven
    • spring boot
    • spring cloud

    1.新建一个maven项目

    2.文件-》新建-》项目

    3.选择Maven project,然后点击下一步

    4.再点击下一步

    5.选择maven-archetype-quicktype

    6.输入group id, artifact id等信息,点击完成

    7.项目结构如图

    8.在pom文件中增加spring cloud配置:

    <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>
    
      <groupId>com.gwolf</groupId>
    
      <artifactId>mircoclouds</artifactId>
    
      <version>0.0.1-SNAPSHOT</version>
    
      <packaging>jar</packaging>
    
      <name>mircoclouds</name>
    
      <url>http://maven.apache.org</url>
    
      <properties>
    
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    
      </properties>
    
      <parent>
    
        <groupId>org.springframework.boot</groupId>
    
        <artifactId>spring-boot-starter-parent</artifactId>
    
        <version>1.5.6.RELEASE</version>
    
    </parent>
    
    <dependencyManagement>
    
        <dependencies>
    
            <dependency>
    
                <groupId>org.springframework.cloud</groupId>
    
                <artifactId>spring-cloud-dependencies</artifactId>
    
                <version>Dalston.SR4</version>
    
                <type>pom</type>
    
                <scope>import</scope>
    
            </dependency>
    
        </dependencies>
    
    </dependencyManagement>
    
    <dependencies>
    
    <dependency>
    
        <groupId>org.springframework.cloud</groupId>
    
        <artifactId>spring-cloud-starter-config</artifactId>
    
    </dependency>
    
    <dependency>
    
        <groupId>org.springframework.cloud</groupId>
    
        <artifactId>spring-cloud-starter-eureka</artifactId>
    
    </dependency>
    
    </dependencies>
    
    </project>
    9.编写Application程序
    package com.gwolf.mircoclouds;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    
    public class Application {
    
        public static void main(String[] args) {
    
            SpringApplication.run(Application.class, args);
    
        }
    
    }

    10.执行Application程序,如果没有错误输出说明spring boot已经搭建成功了。

    11.spring cloud需要了解spring boot的知识,我们会写相关方面的文章介绍spring boot

    原文链接:https://jingyan.baidu.com/article/91f5db1b1c7ebf1c7e05e374.html

  • 相关阅读:
    ASP.NET Core Docker部署
    Asp.net core WebApi 使用Swagger生成帮助页实例
    C#图片文字识别
    C#实现rabbitmq 延迟队列功能
    Windows下当地RabbitMQ服务的安装
    看大数据时代下的IT架构(1)业界消息队列对比
    查看sqlserver被锁的表以及如何解锁
    如何让win2008服务器显示中文无乱码
    Lucene.Net的服务器封装+APi组件 (开源)
    Oracle学习系列4
  • 原文地址:https://www.cnblogs.com/jiafeimao-dabai/p/11725983.html
Copyright © 2011-2022 走看看