CorsConfig.java 515 Bytes
package com.viontech.config;

import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

public class CorsConfig implements WebMvcConfigurer {
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins(new String[] { "*" }).allowCredentials(true)
                .allowedMethods(new String[] { "GET", "POST", "PUT", "DELETE", "OPTIONS" }).maxAge(3600L);
    }
}