I didn't have a for a while. See problems asking ajax requests.

, from a different ip port, for example, from www. Baidu. Com, called. So, between localhost: 8080 and localhost: 8081? Also known as. If processing is bad, errors will be reported, not only the front end error, but the back end will be wrong.

So how do you solve it? the person you're asking, please go down, please. Please listen to me. I'll be able to solve your problem. I'll be sure.

Many people say that spring has its own set of, such as implementing the class of the class. Plus, it's in ajax. _method Wait a minute. The. Is that what you call it. Let's take a look at it. When you resolve put and delete requests, the method method is really true? The answer is that it works. Do you implement other classes. Answer: don't apply in springboot. Because it doesn't have xml, it can be configured. It's ok, and now that you say method can solve put requests, then use it. The answer is, it isn't. I can't.

As you think, you're going to use put, delete,? It must be a restful request, right. Now that it's rest, you'll be sure to deploy the server, so the server 's port and address mustn't be your computer. What's involved,,, and? It's all, if you should solve problems. Do you've the method to do that, but you can't. It's true? there are many answers on the internet, such as obstructions, $, getjson, and so on, too much. But it's very difficult to solve. For example, jsonp 's return square requires callback, then you'll be able to add a callback when you encapsulate json, then destroy the rest of the format. As for other things, it isn't.

Read the code directly.

import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.CorsRegistry;

import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;


public class CrossDomain extends WebMvcConfigurerAdapter {


 public void addCorsMappings(CorsRegistry registry) {


. allowedMethods("GET","HEAD","POST","PUT","DELETE","OPTIONS")

. allowCredentials(false).maxAge(3600);



Paste this code directly into the startup, and you'll complete the security filtering.

The principle is to see the code. And sometimes, I'll analyze the code with everyone. Go ahead, please. Thank you.

Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs