在spring mvc当中配置文件:
xmlns:mvc="http://www.springframework.org/schema/mvc" http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd <!--跨域--> <mvc:cors> <mvc:mapping path="/v1/**" allowed-methods="GET,POST,OPTIONS" allowed-origins="*"/> </mvc:cors>
"/v1/**" 是指定的地址名 **代表v1后的全部地址都可以跨域
GET,POST,OPTIONS 代表可允许的请求