在spring-mvc.xml 中加入如下代码
<mvc:cors>
<mvc:mapping path="/**"
allowed-origins="*"
allowed-methods="POST,GET,OPTIONS,DELETE,PUT,PATCH"
allowed-headers="Content-Type,Access-Control-Allow-Headers,Authorization,X-Requested-With"
allow-credentials="true"/>
</mvc:cors>