package com.yihu.hos;

import com.yihu.hos.interceptor.WebMvcInterceptor;
import com.yihu.hos.web.framework.util.springutil.SpringBeanUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@SpringBootApplication
@EnableCaching
public class ESBApplication extends WebMvcConfigurerAdapter {
    public static void main(String[] args) throws Exception {
        SpringApplication application = new SpringApplication(ESBApplication.class);
        ApplicationContext run = application.run(args);
//        SpringBeanUtil.setContext(run);

    }

    // 增加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new WebMvcInterceptor());
    }

    @Bean
    public SpringBeanUtil springBeanUtil(){return new SpringBeanUtil();}

}
