The Eureka server is a service registration center, and service providers and service consumers are both clients for Eureka.
Eureka server configuration
Add spring-boot-starter-security
Change the POM file:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
Set username and password
Change application.properties:
security.user.password=dubbysecurity.user.name=dubby
Restart and open http://localhost:1111/. If you need to enter your password, it means that the security module has taken effect. Enter the username and password you set and you can enter.
Eureka client configuration
Change application.properties:
The code copy is as follows: eureka.client.serviceUrl.defaultZone=http://dubby:dubby@localhost:1111/eureka/
Note that the format is
The code copy is as follows: eureka.client.serviceUrl.defaultZone=http://${userName}:${password}@localhost:1111/eureka/
At this point, Eureka's basic security configuration is over.
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.