Class CorsConfig

java.lang.Object
com.raphaelsalles.backend.infra.config.CorsConfig
All Implemented Interfaces:
org.springframework.web.servlet.config.annotation.WebMvcConfigurer

@Configuration public class CorsConfig extends Object implements org.springframework.web.servlet.config.annotation.WebMvcConfigurer
Configuração de CORS (Cross-Origin Resource Sharing).

Propósito: Permitir que o frontend (React/Angular) acesse a API backend de domínios diferentes.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addCorsMappings(org.springframework.web.servlet.config.annotation.CorsRegistry registry)
    Configura as regras de CORS globais.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer

    addArgumentResolvers, addErrorResponseInterceptors, addFormatters, addInterceptors, addResourceHandlers, addReturnValueHandlers, addViewControllers, configureApiVersioning, configureAsyncSupport, configureContentNegotiation, configureDefaultServletHandling, configureHandlerExceptionResolvers, configureMessageConverters, configureMessageConverters, configurePathMatch, configureViewResolvers, extendHandlerExceptionResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
  • Constructor Details

    • CorsConfig

      public CorsConfig()
  • Method Details

    • addCorsMappings

      public void addCorsMappings(org.springframework.web.servlet.config.annotation.CorsRegistry registry)
      Configura as regras de CORS globais.

      Nota de Auditoria: Atualmente permite todas as origens (*). Em produção, deve ser restrito ao domínio do frontend.

      Specified by:
      addCorsMappings in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer