DemoApplication.java
1.04 KB
package com.example;
import com.example.filter.CORSFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@MapperScan(basePackages = {"com.example.mapper.*"})
@SpringBootApplication
@RestController
@RequestMapping("/test")
public class DemoApplication extends WebMvcConfigurerAdapter{
Logger logger = LoggerFactory.getLogger(getClass());
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new CORSFilter()).addPathPatterns("/**");
}
}