• 【SpringCloud】极简SpringCloudServer工程


    本例基于SpringBoot 2.5.5,不保证其它版本的适用性。

    例程:https://files.cnblogs.com/files/heyang78/simpleSpringCloudServer_210926.rar

    重要设置:

    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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.5.5</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.example</groupId>
        <artifactId>demo-1</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>demo-1</name>
        <description>Demo project for Spring Boot</description>
        <properties>
            <java.version>11</java.version>
            <spring-cloud.version>2020.0.4</spring-cloud.version>
        </properties>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter</artifactId>
            </dependency>

    <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-function-context</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency>

    </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>

    配置文件:

    spring.application.name=erkserver
    eureka.client.register-with-eureka=false
    eureka.client.fetch-registry=false

    启动类:

    package com.example.demo;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
    
    @SpringBootApplication
    @EnableEurekaServer
    public class Demo1Application {
    
        public static void main(String[] args) {
            SpringApplication.run(Demo1Application.class, args);
        }
    
    }

    启动后在http://localhost:8080/的效果:

     这个工程可以作为SpringCloud的起始工程。

    END

  • 相关阅读:
    非凸优化的方法
    随机梯度下降与批量梯度下降
    python requests用于测试
    Vscode中运行js文件或部分代码 ,在下面cmd输出中显示结果
    ts问题处理(2): 'Promise' only refers to a type, but is being used as a value here.
    typeScript入门基础 (1)
    node启动服务报错Node.js Error: Cannot find module express
    能改变this各种情况下的总结,还有没有总结到的,请留言!!
    flutter安装与配置 v1.2.1版本
    vue项目webpack打包后有的文件big 问题
  • 原文地址:https://www.cnblogs.com/heyang78/p/15337471.html
Copyright © 2020-2023  润新知