package info.aspirecn.iov.sjjh.servicenode.fed;

import info.aspirecn.iov.sjjh.servicenode.fed.filter.RequestForwardFiler;
import info.aspirecn.iov.sjjh.servicenode.fed.filter.VueIndexFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;

@EnableEurekaClient
@EnableZuulProxy
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Bean
    public RequestForwardFiler requestForwardFiler(){
        return new RequestForwardFiler();
    }

    @Bean
    public FilterRegistrationBean vueIndexFilter(){
        FilterRegistrationBean registrationBean = new FilterRegistrationBean();
        registrationBean.addUrlPatterns("/*");
        registrationBean.setName("vueIndexFilter");
        registrationBean.setOrder(1);
        registrationBean.setFilter(new VueIndexFilter());
        return registrationBean;
    }
}
