from origin 'http://localhost:8080' has been blocked by CORS policy

`package com.demo.config;

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

/**

  • Author:js
  • Date:2019/

*/
@Configuration
@EnableWebMvc
public class CorsConfig extends WebMvcConfigurerAdapter {

@Overridepublic void addCorsMappings(CorsRegistry registry) {    registry.addMapping("/**");}

}`