Eureka调度服务:

Gradle依赖包:

基础框架依赖配置核心代码:

    buildscript {
repositories {
mavenCentral()
}
dependencies {classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.14.RELEASE' }
} afterEvaluate {Project project ->
if (project.pluginManager.hasPlugin('java')) {
configurations.all {
resolutionStrategy.eachDependency {DependencyResolveDetails details ->
forceVersion details, 'org.springframework.boot', '1.5.14.RELEASE'
forceVersion details, 'org.springframework.cloud:spring-cloud-dependencies', 'Edgware.SR4'
forceVersion details, 'org.slf4j', '1.7.21'
}
exclude module:'slf4j-log4j12'
exclude module:'log4j'
}
dependencies {testCompile 'junit:junit:4.12' }
}
} repositories {
mavenCentral()
}

调度服务bulid.gralde:

apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management' ext {
springCloudVersion = 'Edgware.SR4'
} dependencies {
compile 'org.springframework.cloud:spring-cloud-starter-eureka-server'
compile 'org.springframework:springloaded'
compile 'org.springframework.boot:spring-boot-devtools'
} dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

服务启动类:

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

app.yml配置:

server:
port: 8761 eureka:
instance:
hostname: localhost
client:
register-with-eureka: false
fetch-registry: false
service-url:
defaultZone: http://localhost:${server.port}/eureka/

启动服务,访问http://127.0.0.1:8761/eureka

注册中心启动完成;

Spring Eureka的使用入门的更多相关文章

  1. Spring Eureka的使用入门--服务端与客户端

    接上篇: Eureka作为注册中心,连接服务端与客户端: 服务端: 依赖包: apply plugin: 'org.springframework.boot' apply plugin: 'io.sp ...

  2. spring boot(一):入门篇

    构建微服务:Spring boot 入门篇 什么是spring boot Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框 ...

  3. Spring 核心概念以及入门教程

    初始Spring 在学习Spring之前我们首先要了解一下企业级应用.企业级应用是指那些为商业组织,大型企业而创建并部署的解决方案及应用. 这些大型企业级应用的结构复杂,涉及的外部资源众多,事务密集, ...

  4. Spring MVC 教程,快速入门,深入分析

    http://elf8848.iteye.com/blog/875830/ Spring MVC 教程,快速入门,深入分析 博客分类: SPRING Spring MVC 教程快速入门  资源下载: ...

  5. Spring中IoC的入门实例

    Spring中IoC的入门实例 Spring的模块化是很强的,各个功能模块都是独立的,我们可以选择的使用.这一章先从Spring的IoC开始.所谓IoC就是一个用XML来定义生成对象的模式,我们看看如 ...

  6. Spring Boot(一):入门篇+前端访问后端

    转自:Spring Boot(一):入门篇 什么是Spring Boot Spring Boot 是由 Pivotal 团队提供的全新框架,其设计目的是用来简化新 Spring 应用的初始搭建以及开发 ...

  7. Spring _day02_IoC注解开发入门

    1.Spring IoC注解开发入门 1.1 注解开发案例: 创建项目所需要的jar,四个基本的包(beans core context expression ),以及两个日志记录的包,还要AOP的包 ...

  8. Spring MVC+Spring+Mybatis+MySQL(IDEA)入门框架搭建

    目录 Spring MVC+Spring+Mybatis+MySQL(IDEA)入门框架搭建 0.项目准备 1.数据持久层Mybatis+MySQL 1.1 MySQL数据准备 1.2 Mybatis ...

  9. Spring Boot:快速入门教程

    什么是Spring Boot? Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人 ...

随机推荐

  1. xcode添加build phase

    [xcode添加build phase] xcode版本:5.0.2,找了半天,终于找到add build phase的方法,如下图.

  2. Asp.net Web Application 打开 SharePoint 2010 Site 错误 The Web application at could not be found

    解决办法如下: 1. 修改项目的.net framework 为3.5 2. Application Pool 选用 Sharepoint App pool 3. 修改 web.config如下: & ...

  3. Lambda03 方法引用、类型判断、变量引用

    1 方法引用 1.1 方法引用的好处 方法引用结合 Lambda 可以引用已存在的方法,省略很多编码,而且可读性更强,它可以自动装配参数与返回值. 在编写lambda表达式的时候可以通过方法引用的方式 ...

  4. c语言交换两个变量的值

    有两个变量a 和b,想要交换它们的值 int a,b; 能不能这样操作呢? b=a; a=b; 不能啊,这样操作的意思是把a的值放到b中,然后b中的值已经被覆盖掉了,已经不是b原来的那个值了,所以是没 ...

  5. 手打的table

    突然觉得,如果我不上传源码和写篇博客,对不起花在这个破网页2个小时的时间,完全手打,浏览器调效果. 源码如下: a.html: <!DOCTYPE html PUBLIC "-//W3 ...

  6. redis过期key的清理策略

    一,有三种不同的删除策略(1),立即清理.在设置键的过期时间时,创建一个回调事件,当过期时间达到时,由时间处理器自动执行键的删除操作. (2),惰性清理.键过期了就过期了,不管.当读/写一个已经过期的 ...

  7. HandleErrorAttribute只能处理httpStatusCode为500的异常(服务器异常)

    HandleErrorAttribute源代码: [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited ...

  8. C#中ref和out的作用和区别

    相同点:方法的定义和调用都必须显示使用ref.out关键字.都会导致参数按引用传递. 不同点:传递给ref关键字的参数必须赋初始值,而out不用.out关键字会清空变量,即使变量已经赋值也不行,退出函 ...

  9. poj2513 Fence Repair(小根堆)

    Description Farmer John wants to repair a small length of the fence around the pasture. He measures ...

  10. MVC中的Controllers和View分别放到单独的项目中

    将Controllers放到独立项目中: 第一步:创建Mvc.Controllers,Mvc.Models和UI三个项目 Mvc.Controllers用来编写Controllers Mvc.Mode ...