先上轮子:
@SpringBootApplication
@Configuration
public class DatabastobeansApplication {
public static void main(String[] args) {
SpringApplication.run(DatabastobeansApplication.class, args);
}
// 解决No 'Access-Control-Allow-Origin' header is present on the requested resource.
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebConfig();
// return new WebMvcConfigurerAdapter() {
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**");
// }
// };
}
}