File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/main/java/com/gabriel_torelo/game_list/config Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .gabriel_torelo .game_list .config ;
2+
3+ import org .springframework .beans .factory .annotation .Value ;
4+ import org .springframework .context .annotation .Bean ;
5+ import org .springframework .context .annotation .Configuration ;
6+ import org .springframework .web .servlet .config .annotation .CorsRegistry ;
7+ import org .springframework .web .servlet .config .annotation .WebMvcConfigurer ;
8+
9+ @ Configuration
10+ public class WebConfig {
11+
12+ @ Value ("${cors.origins}" )
13+ private String corsOrigins ;
14+
15+ @ Bean
16+ public WebMvcConfigurer corsConfigurer () {
17+ return new WebMvcConfigurer () {
18+ @ Override
19+ public void addCorsMappings (CorsRegistry registry ) {
20+ registry .addMapping ("/**" ).allowedMethods ("*" ).allowedOrigins (corsOrigins );
21+ }
22+ };
23+ }
24+
25+ }
You can’t perform that action at this time.
0 commit comments