package zhangchao.blog2;
import java.math.BigDecimal;
import java.util.UUID;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/user")
public class UserController {
@RequestMapping(value="",method=RequestMethod.POST)
public User save(@RequestBody User user){
user.id = UUID.randomUUID().toString();
return user;
}
@RequestMapping(value="/{id}",method=RequestMethod.GET)
public User get(@PathVariable String id){
User user = new User();
user.balance = new BigDecimal("3.2");
user.id = id;
user.name = "小明";
return user;
}
@RequestMapping(value="",method=RequestMethod.PUT)
public User update(@RequestBody User user){
return user;
}
@RequestMapping(value="/{id}",method=RequestMethod.DELETE)
public String delete(@PathVariable String id){
return "success";
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
pringBoot全局 配置支持CORS前后端例子
共12个文件
html:5个
java:4个
js:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 207 下载量 20 浏览量
2017-01-03
10:01:55
上传
评论 1
收藏 70KB RAR 举报
温馨提示
本资源主要演示了Spring Boot 如何全局配置跨域资源共享。本资源解压后包含2个文件夹:blog2和testFrontEnd。blog2是后端java代码项目,由Maven构建。testFrontEnd是前端项目,测试了能否正常使用跨域的Web API。
资源推荐
资源详情
资源评论
收起资源包目录
SpringBoot全局支持CORS前后端例子.rar (12个子文件)
SpringBoot全局支持CORS前后端例子
blog2
pom.xml 1KB
src
test
resources
java
main
resources
java
zhangchao
blog2
User.java 155B
UserController.java 1KB
Blog2MvcConfig.java 565B
Blog2Application.java 314B
testFrontEnd
add.html 2KB
vue.js 212KB
index.html 447B
vue-resource.js 34KB
update.html 2KB
delete.html 1KB
detail.html 1KB
共 12 条
- 1
zhangchao19890805
- 粉丝: 311
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页