Two ways of spring boot Ajax cross domain
•
Java
preface
In most cases, the Java language will be used as a back-end language for the front-end PHP, node JS provides API interfaces. The front end calls Java API services through Ajax requests. Today with node JS as an example, this paper introduces two cross domain methods: crossorigin and reverse proxy.
1、 Preparatory work
pom. xml:
pom. xml
App. java
User. java
MainController. java:
The project structure is shown in the figure below:
visit http://localhost:8080/findAllUser
In visit http://localhost:3000 , the effect is as follows:
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码