|
@ -5,6 +5,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
|
|
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
|
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
|
|
|
|
/**
|
|
|
* Created by chenweida on 2017/5/10.
|
|
@ -19,6 +22,15 @@ public class DiscoveryServer extends SpringBootServletInitializer {
|
|
|
|
|
|
@Override
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
|
|
|
|
|
return application.sources(DiscoveryServer.class);
|
|
|
}
|
|
|
|
|
|
@EnableWebSecurity
|
|
|
static class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
@Override
|
|
|
protected void configure(HttpSecurity http) throws Exception {
|
|
|
http.csrf().disable().authorizeRequests().anyRequest().authenticated().and().httpBasic();
|
|
|
}
|
|
|
}
|
|
|
}
|