Git Product home page Git Product logo

spring-cloud-boilerplate's Introduction

Overview

The boilerplate for spring cloud with following feature enabled

feature implementation version
discovery eureka Dalston.SR1
gateway zuul Dalston.SR1

Please check out gradle/dependencies.gradle

Get Started

Please make sure Java , Gradle & Docker are ready on your dev machine.

env version
Java 1.8.x
Gradle 2.14.x
Docker 17.x
Docker Compose 1.16.*

Build

gradle clean build
docker-compose build

Start

docker-compose up -d

Stop

docker-compose down

Configuration

discovery

  • gradle

discovery/build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
    }
}

apply plugin: "io.spring.dependency-management"
apply plugin: 'org.springframework.boot'

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-starter-parent:${springCloudVersion}"
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

dependencies {
    compile "org.springframework.cloud:spring-cloud-starter-eureka-server"
}

  • spring boot - bootstrap.yml

discovery/src/main/resources/bootstrap.yml

spring:
  application:
    name: discovery
  • spring boot - application.yml

discovery/src/main/resources/application.yml

server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  server:
    enable-self-preservation: false
    eviction-interval-timer-in-ms: 60000
  client:
    registerWithEureka: false
    fetchRegistry: false
    serviceUrl:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

gateway

  • gradle

gateway/build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
    }
}

apply plugin: "io.spring.dependency-management"
apply plugin: 'org.springframework.boot'

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-starter-parent:${springCloudVersion}"
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

dependencies {
    compile "org.springframework.cloud:spring-cloud-starter-eureka"
    compile "org.springframework.cloud:spring-cloud-starter-zuul"

    testCompile "org.springframework.boot:spring-boot-starter-test"
}

  • spring boot - bootstrap.yml

gateway/src/main/resources/bootstrap.yml

spring:
  application:
    name: gateway
  • spring boot - application.yml

gateway/src/main/resources/application.yml

server:
  port: 10000

eureka:
  instance:
    hostname: ${EUREKA_INSTANCE_HOST:localhost}
    non-secure-port: ${EUREKA_INSTANCE_PORT:10000}
    prefer-ip-address: false
#    instance-id: ${spring.application.name}:${eureka.instance.hostname}:${eureka.instance.non-secure-port}:${random.value}
  client:
    registerWithEureka: false
    fetchRegistry: true
    serviceUrl:
       defaultZone: ${EUREKA_SERVICE_URL:'http://localhost:8761/eureka/'}

Customization

TODO

spring-cloud-boilerplate's People

Contributors

melthaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.