※ Notes @CrossOrigin solve cross-domain problems : Spring Framework 4.2 GA to CORS provides first-class support, so you usually easier and more powerful than the earth configure it based solution filter. So springMVC version to support only version 4.2 or above @CrossOrigin
♬ reference link: https: //www.cnblogs.com/mmzs/p/9167743.html
package cn.itcast.haoke.dubbo.api.controller;
import cn.itcast.haoke.dubbo.api.config.MockConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RequestMapping("mock")
@RestController
@CrossOrigin
public class MockController {
@Autowired
private MockConfig mockConfig;
/*菜单*/
@GetMapping("index/menu")
public String indexMenu() {
return this.mockConfig.getIndexMenu();
}
/*首页资讯*/
@GetMapping("index/info")
public String indexInfo() {
return this.mockConfig.getIndexInfo();
}
/ **
* * Home Q
* @return *
*
* /
@GetMapping ( "index / FAQ")
public String indexFaq () {
return this.mockConfig.getIndexFaq ();
}
}