栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

035

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

035

1. 服务器端例子

1.1. 使用maven构建SpringBoot的名叫sing-boot-admin-server项目

1.2. 配置pom.xml 


	
	4.0.0
	com.bjbs
	sing-boot-admin-server
	0.0.1-SNAPSHOT
	
	
		org.springframework.boot
		spring-boot-starter-parent
		1.5.13.RELEASE
	
	
	
		1.8
	
	
	
		
			org.springframework.boot
			spring-boot-starter-web
		
		
		
			de.codecentric
			spring-boot-admin-starter-server
			1.5.7
		
	

1.3. 在src/main/resources下, 新建application.properties, 配置端口号

server.port=9090

1.4. 新建App.java

package com.bjbs;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import de.codecentric.boot.admin.config.EnableAdminServer;

@SpringBootApplication
@EnableAdminServer // 开启AdminServer
public class App {
	public static void main(String[] args) {
		SpringApplication.run(App.class, args);
	}
}

2. 客户端例子

2.1. 使用maven构建SpringBoot的名叫sing-boot-admin-server项目

2.2. 配置pom.xml 



	4.0.0
	com.bjbs
	spring-boot-admin-client
	0.0.1-SNAPSHOT

	
		org.springframework.boot
		spring-boot-starter-parent
		1.5.13.RELEASE
	

	
		1.8
	

	
		
			org.springframework.boot
			spring-boot-starter-web
		
		
		
			de.codecentric
			spring-boot-admin-starter-client
			1.5.7
			
				
					org.jolokia
					jolokia-core
				
				
					com.googlecode.json-simple
					json-simple
				
			
		
	

2.3. 在src/main/resources下, 新建application.properties

#关闭安全限制, 它的默认值是true
management.security.enabled=false
#Spring Boot Admin服务端的IP地 址以及端口号 
spring.boot.admin.url: http://localhost:9090

2.4. 新建App.java

package com.bjbs;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class App {
	public static void main(String[] args) {
		SpringApplication.run(App.class, args);
	}
}

3. 运行项目

3.1. 运行服务端

3.2. 运行客户端 

3.3. 浏览器访问服务器端 

3.4. 查看详情 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/727170.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号