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();
}
}