0

I have a Eureka server with config

# Eureka configuration

    eureka.instance.hostname: localhost
    eureka.client.registerWithEureka: false
    eureka.client.fetchRegistry: false
    eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/

Also, running two microservices of customer and orders with Eureka Discovery enabled. I want to access Orders microservice in customers microservice, but eureka is not discovering order microservice.

In my both services, security is implemented that way

@Configuration
@EnableResourceServer
public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter {

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http.cors().and().csrf().disable()
                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
                .and().authorizeRequests().antMatchers("/api/**").authenticated()
                .and().authorizeRequests().antMatchers("/swagger-ui.html").permitAll()
                .and().authorizeRequests().antMatchers("/**").authenticated();
    }
}
Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

0

It seems that you are missing the @EnableDiscoveryClient client-side annotation. It usually goes with @SpringBootApplication.

The @EnableDiscoveryClient activates the Netflix Eureka DiscoveryClient implementation. There are other implementations for other service registries like Hashicorp’s Consul or Apache Zookeeper.

Reference: https://spring.io/guides/gs/service-registration-and-discovery/

Fabio Manzano
  • 2,847
  • 1
  • 11
  • 23
  • Hi friend, there is some different parameters to set for making it workable on cloud. i have fixed that issue by someone help. – M.Haris Qayyum Sep 02 '18 at 21:14