I am trying to learn spring with this tutorial:
https://spring.io/guides/tutorials/react-and-spring-data-rest/
but I am doing frontend app as a separate app. While making a call to: http://localhost:8080/api/employees
how to enable CORS globally ? thanks!
Tried in Application with:
@Bean
public WebMvcConfigurer configurer()
{
return new WebMvcConfigurer()
{
@Override
public void addCorsMappings(CorsRegistry registry)
{
registry.addMapping("/api/*").allowedOrigins("http://localhost:8000");
}
};
}
but it does not help
did some testing with custom @RestController like here:
https://spring.io/guides/gs/rest-service-cors/#global-cors-configuration and calling http://localhost:8080/api/greeting from external frontend app works fine, only those rest endpoints CRUD auto generated via spring are not allowed CORS there.. How to avoid this issue ?
from external frontend app works fine, only those rest endpoints CRUD auto generated via spring are not allowed CORS there.. How to avoid this issue ?