title: Annotation CrossOrigin not working in Spring boot
body: <p>I have a Spring Boot application that exposes some endpoints. From a React app I want to make requests to these endpoints, but it keeps giving me CORS problem:</p>
  
  <blockquote>
    <p>access to XMLHttpRequest at
    'localhost:9090/helios-admin/api/dashboard/clients?page=0&amp;size=30'
    from origin '<a href="http://localhost:3000" rel="nofollow noreferrer">http://localhost:3000</a>' has been blocked by CORS policy:
    Cross origin requests are only supported for protocol schemes: http,
    data, chrome, chrome-extension, https.</p>
  </blockquote>
  
  <p>So I've tried using <code>@CrossOrigin</code> annotation for all my methods and also for the Controller class, but the error is the same.<br>
  The get request in my react app looks like this: </p>
  
  <pre><code>constructor() {
          this.url = 'localhost:9090/helios-admin/api/dashboard/clients?page=0&amp;size=30';
      }
  
      getProjectStatusById(projectId) {
          Axios.get(this.url).then(res=&gt;{
              console.log(res.data);
          })
      }
  </code></pre>
  
  <p>What's missing?</p>
  
  <p><strong>EDIT</strong>
  In my spring boot app I have only this class to configure security:</p>
  
  <pre><code>@Configuration
  @EnableWebSecurity
  @EnableGlobalMethodSecurity(securedEnabled = true, jsr250Enabled = true, prePostEnabled = true)
  public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
  
  
  
      @Autowired
      SysdataUserDetailsService sysdataUserDetailsService;
  
  
  
      @Autowired
      private JwtAuthEntryPoint jwtAuthEntryPoint;
  
  
  
      @Override
      protected void configure(AuthenticationManagerBuilder auth) throws Exception {
          auth
                  .userDetailsService(sysdataUserDetailsService)
                  .passwordEncoder(encoder());
      }
  
  
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http.cors().and().csrf().disable().authorizeRequests()
                  .antMatchers(PathConstants.USER_AUTH +"/**", PathConstants.HELIOS+"/dashboard/**").permitAll()
                  .antMatchers(HttpMethod.GET, "/"+PathConstants.PROCESS_DEFINITION+"/**").permitAll()
                  .antMatchers(HttpMethod.POST, "/"+PathConstants.PROCESS_DEFINITION+"/**").permitAll()
                  .antMatchers(HttpMethod.GET, "/"+PathConstants.PROCESS_INSTANCE+"/**").permitAll()
                  //.anyRequest().authenticated()
                  .anyRequest().permitAll()
                  .and()
                  .exceptionHandling().authenticationEntryPoint(jwtAuthEntryPoint).and()
                  .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
          // custom jwt filter.
          http.addFilterBefore(jwtAuthFilter(), UsernamePasswordAuthenticationFilter.class);
      }
  }
  </code></pre>