package com.learn.wechat.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;
import com.learn.wechat.model.User;
import com.learn.wechat.service.UserService;
@RestController
@RequestMapping(value="/framework")
public class UserController {
@Autowired
private UserService userService;
@RequestMapping(value="/saveUser",
method=RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8")
public String saveUser(@RequestBody User user){
return userService.add(user);
}
@RequestMapping(value="/saveUser/{account}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8")
public String add(@PathVariable String account){
return userService.addUser(account);
}
@RequestMapping(value="/user/{id}",
method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE+";charset=UTF-8")
public User add(@PathVariable Long id){
return userService.getOneUser(id);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
SpringMVC.rar (34个子文件)
SpringMVC
pom.xml 4KB
target
test-classes
m2e-wtp
web-resources
META-INF
maven
com.learn.test
SpringMVC
pom.xml 4KB
pom.properties 220B
MANIFEST.MF 114B
classes
jdbc.properties 501B
log4j.properties 384B
com
learn
wechat
dao
UserDao.class 320B
model
User.class 1KB
controller
UserController.class 2KB
service
UserService.class 1KB
hello
HelloController.class 655B
SpringMVC-servlet.xml 2KB
applicationContext.xml 4KB
.settings
org.eclipse.m2e.core.prefs 90B
org.eclipse.wst.jsdt.ui.superType.name 6B
org.eclipse.wst.common.project.facet.core.xml 252B
org.eclipse.wst.common.component 752B
org.eclipse.wst.jsdt.ui.superType.container 49B
org.eclipse.wst.validation.prefs 50B
.jsdtscope 575B
org.eclipse.jdt.core.prefs 430B
src
test
java
main
webapp
WEB-INF
web.xml 1KB
index.jsp 52B
resources
jdbc.properties 501B
log4j.properties 384B
SpringMVC-servlet.xml 2KB
applicationContext.xml 4KB
java
com
learn
wechat
dao
UserDao.java 204B
model
User.java 904B
controller
UserController.java 1KB
service
UserService.java 672B
hello
HelloController.java 386B
.project 1KB
.classpath 1KB
共 34 条
- 1
资源评论
OceanLead
- 粉丝: 9
- 资源: 7
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功