I am using Spring mvc with React Js but unable to solve the problem of Cors.When i post or want to get the data from spring mvc controller its gives error Cross origion not allowed.i have added this these lines in applicationcontext.xml file but failed to build and run the application
<bean id="corsFilter" class="org.springframework.web.filter.CorsFilter">
<constructor-arg>
<bean class="org.springframework.web.cors.CorsConfiguration">
<property name="allowedOrigins" value="http://localhost:8081" />
<property name="allowedMethods" value="GET,POST,PUT,DELETE,OPTIONS" />
<property name="allowedHeaders" value="*" />
<property name="allowCredentials" value="true" />
</bean>
</constructor-arg>
</bean>
<!-- Register CorsFilter bean with the servlet context -->
<bean class="org.springframework.web.servlet.DispatcherServlet" name="dispatcherServlet">
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</bean>
I want to gett result of all request is successfully procesed what i am sending from React to Spring MVC Controller