Spring Cloud的偏旧版的Spring Security认证的Eureka服务发现与服务注册配置

因为新版的和旧版的有配置上的不同,所以这里简单记录,结合旧版和新版的相互参考

pom文件中配置的spring-boot版本:


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



		
			org.springframework.cloud
			spring-cloud-starter-eureka-server
			1.3.6.RELEASE
		
		
		
			org.springframework.boot
			spring-boot-starter-security
		

服务端:

security:
  basic:
    enabled: true
  user:
    name: user
    password: password123
server:
  port: 8761
  
# eureka-Server也有eureka Client[即eureka-Server同样也是一个eureka-Client]
eureka:
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://user:password123@localhost:8761/eureka

客户端:

server:
  port: 8082
  
spring:
  application:
    name: client-demo
 
eureka:
  client:
    healthcheck:
      enabled: true
    serviceUrl:
      defaultZone: http://user:password123@localhost:8761/eureka
  instance:
    prefer-ip-address: true  #让eureka界面的主机名显示为IP
    instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}

关于服务端与客户端的搭建

参考:

Eureka Server搭建:https://blog.csdn.net/weixin_42465125/article/details/88233722

客户端搭建:https://blog.csdn.net/weixin_42465125/article/details/88337698

********************************* 不积跬步无以至千里,不积小流无以成江海 ********************************* 

你可能感兴趣的:(SpringCloud)