看了那么多,搞了这么久,一个 @CrossOrigin注解解决所有问题!!!

在Controller层注解@CrossOrigin;

@CrossOrigin
@Controller
public class UserController {   // http://localhost:8080/Sun/src/main/java/controller/UserController/select

    @Autowired
    private UserDao userDao;
	
	do something ...
	
}

然后在方法层,注解请求的方式,POSTGET, 即


@RequestMapping(value = "/demo", method = RequestMethod.POST)