The Spring Cloud DiscoveryClient always returns a URI starting with https for a service configured this way. Please find the below code. The @EnableEurekaServer annotation is used to make your Spring Boot application acts as a Eureka Server.The code for main Spring Boot application class file is as shown below −Make sure Spring cloud Eureka server dependency is added in your build configuration file.The code for Maven user dependency is shown below −The code for Gradle user dependency is given below −The complete build configuration file is given below −By default, the Eureka Server registers itself into the discovery. Secure RestController Methods@PostMapping and @RequestBody Example in Spring MVCUse Mockito’s thenCallRealMethod() to Call a Real MethodSpring Boot and MongoTemplate Tutorial with MongoDB For this, we need to develop the Eureka server and run it on the default port 8761.After downloading the project in main Spring Boot Application class file, we need to add @EnableEurekaServer annotation. Doing so makes Eureka publish instance information that shows an explicit preference for secure communication. Eureka Server is an application that holds the information about all client-service applications. The code for application.yml file is given below −

To register the Spring Boot application into Eureka Server we need to add the following configuration in our application.properties file or application.yml file and specify the Eureka Server URL in our configuration. Create a Spring boot project from Spring boot initializer/Spring tool suite with these dependencies Eureka Server, Actuator, Web, Spring Boot Admin Server.

See also below for details of Ribbon support on the client side for Zones and Regions.

6.

If you attempt to open Eureka dashboard in the browser window now, you should be prompted to provide username and password first.

In this tutorial, I am going to share with you how to secure Spring Cloud Eureka dashboard with Spring Security.To learn how to build RESTful Microservices with Spring Cloud by watching step-by-step To secure Eureka with Spring Security we will need to add Spring Security dependency to a pom.xml file of our Eureka Discovery Server Spring Boot project. Override the configure() method and configure HttpSecurity object as is shown below:Eureka Discovery Server is now protected with Spring Security and is ready to be used.If you attempt to open Eureka dashboard in the browser window now, you should be prompted to provide username and password first.To make your Microservices and other Eureka clients be able to authenticate with Eureka and register with it. By default, every Eureka server is also a Eureka client and requires (at least one) service URL to locate a peer.

... Notice that the Eureka Default Zone URL now has the username and password added.

You should add the below given configuration into your application.properties file or application.yml file.Now, you can create an executable JAR file, and run the Spring Boot application by using the Maven or Gradle commands shown below −After “BUILD SUCCESS”, you can find the JAR file under the target directory.After “BUILD SUCCESSFUL”, you can find the JAR file under the build/libs directory.Now, run the JAR file by using the following command −You can find that the application has started on the Tomcat port 8761 as shown below − this was to have a simplified setup (1 less server). Eureka Server comes with the bundle of Spring Cloud. Open the pom.xml file of your Eureka Discovery Server project and add the following dependency.Once you have added the Spring Security dependency to the pom.xml file, as shown above, open application.properties file of your Eureka Discovery Server and add the following configuration properties:The next step is to configure HttpSecurity object in Eureka Discovery Server. Every Micro service will register into the Eureka server and Eureka server knows all the client applications running on each port and IP address. changing the server context doesn't let me do this unfortunetely . I was trying to have a single spring boot server that hosted a website and on that same server have the eureka server + its web ui running.