package io.fundrequest.restapi.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class CustomWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("redirect:/index.html");
        registry.addViewController("/api").setViewName("redirect:/api/");
        registry.addViewController("/api/").setViewName("redirect:/api/index.html");
        registry.addViewController("/api/docs").setViewName("redirect:/api/docs/");
        registry.addViewController("/api/docs/").setViewName("forward:/api/docs/index.html");
        registry.addViewController("/api/login").setViewName("redirect:/api/login/");
        registry.addViewController("/api/login/").setViewName("forward:/api/login/index.html");
        registry.addViewController("/api/activity").setViewName("redirect:/api/activity/");
        registry.addViewController("/api/activity/").setViewName("forward:/api/activity/index.html");
        super.addViewControllers(registry);
    }
}
@@ -64,40 +64,170 @@
 ork.
-context.annotation.Configuration
+beans.factory.annotation.Value;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.web.servlet.config.annotation.CorsRegistry
 ;%0Aim
@@ -481,16 +481,108 @@
 pter %7B%0A%0A
+    @Value(%22#%7B'$%7Bcors.allowed-origins%7D'.split(',')%7D%22)%0A    private String%5B%5D allowedOrigins;%0A%0A
     @Ove
@@ -1497,9 +1497,202 @@
 ;%0A    %7D%0A
+%0A    @Override%0A    public void addCorsMappings(CorsRegistry registry) %7B%0A        registry.addMapping(%22/**%22)%0A                .allowedOrigins(allowedOrigins)%0A                .maxAge(3600);%0A    %7D%0A%0A
 %7D

add cors setup