You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.8 KiB

1 year ago
package com.net;
import com.net.filter.CorsFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
1 year ago
import javax.servlet.http.HttpServletRequest;
1 year ago
/**
* Created by Administrator on 2017/8/15.
*/
@SpringBootApplication
@EnableScheduling
@EnableTransactionManagement
@EnableFeignClients
@EnableAsync
@RestController
public class WebSocketApplication extends WebMvcConfigurerAdapter {
private static Logger log = LoggerFactory.getLogger(WebSocketApplication.class);
public static void main(String[] args) throws Exception {
SpringApplication.run(WebSocketApplication.class, args);
}
@RequestMapping(value = "/")
@ResponseBody
public String weChatLogin(HttpServletRequest request){
return "hello open";
}
@Bean
public FilterRegistrationBean filterRegist() {
FilterRegistrationBean frBean = new FilterRegistrationBean();
frBean.setFilter(new CorsFilter());
frBean.addUrlPatterns("/*");
return frBean;
}
}