| | |
| | | import springfox.documentation.swagger.web.SwaggerResource; |
| | | import springfox.documentation.swagger.web.SwaggerResourcesProvider; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.TimeZone; |
| | | |
| | | //@EnableHystrix |
| | | @EnableSwagger2Doc |
| | | @EnableZuulProxy//开启网关服务 |
| | | @EnableDiscoveryClient//开启eureka客户端的消费者 |
| | | @SpringBootApplication |
| | | public class ZuulApplication extends SpringBootServletInitializer { |
| | | public class ZuulApplication /*extends SpringBootServletInitializer*/ { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(ZuulApplication.class, args); |
| | |
| | | nettyServer.bind(); |
| | | NettyServer0 nettyServer0 = new NettyServer0(); |
| | | nettyServer0.bind(); |
| | | } |
| | | |
| | | |
| | | @PostConstruct |
| | | void started() { |
| | | TimeZone.setDefault(TimeZone.getTimeZone("GMT+0")); |
| | | } |
| | | |
| | | |
| | |
| | | public List<SwaggerResource> get() { |
| | | List resource=new ArrayList<>(); |
| | | //name可以随便写,location前缀要与zuul配置的path一致。zuul开了token验证,要加上token,否则不用加?token=1 |
| | | // resource.add(swaggerResource("user","/user-server/v2/api-docs","1.0")); |
| | | // resource.add(swaggerResource("driver","/driver-server/v2/api-docs","1.0")); |
| | | // resource.add(swaggerResource("dispatch","/dispatch-server/v2/api-docs","1.0")); |
| | | resource.add(swaggerResource("user","/user-server/v2/api-docs","1.0")); |
| | | resource.add(swaggerResource("driver","/driver-server/v2/api-docs","1.0")); |
| | | return resource; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | return builder.sources(ZuulApplication.class); |
| | | } |
| | | // @Override |
| | | // protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { |
| | | // return builder.sources(ZuulApplication.class); |
| | | // } |
| | | } |