package com.sample.smartmap.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import com.sample.smartmap.entity.User;
import com.sample.smartmap.service.UserService;
/**
* mvc url映射测试
* @author lijiazhi
*
*/
@Controller
@RequestMapping("/urlmapper")
public class URLMapperController { @Autowired UserService userService; @RequestMapping(path="/user/all/*.json" ,method = RequestMethod.GET)
@ResponseBody
public List<User> allUser() {
return userService.allUser();
} @RequestMapping(path="/user/{id}.json" ,method = RequestMethod.GET)
@ResponseBody
public User getById( @PathVariable Long id) {
return userService.getUserById(id);
} @GetMapping(path = "/{userId}.json", produces = "application/json")
@ResponseBody
public User getUserById( @PathVariable Long userId) {
return userService.getUserById(userId);
} @GetMapping(value="/consumes/test.json",consumes = "application/json" )
@ResponseBody
public User forJson() {
return userService.getUserById(1l);
} }

最新文章

  1. 《C#并发编程经典实例》笔记
  2. LeakCanary Android 和 Java 内存泄露检测。
  3. SQL注入的原理以及危害
  4. nios II--实验3——led 100M硬件部分
  5. nginx安装ssl
  6. Linq二 LinqToSql
  7. 《Java程序性能优化》学习笔记 JVM和并发优化
  8. 记redis的一个测试
  9. Android本地JUnit Text
  10. Secure CRT 如何连接虚拟机里面的CentOS系统 当主机没有网的时候 作者原创 欢迎转载
  11. php Debugging with Xdebug and Sublime Text 3(转)
  12. unity3D:游戏分解之曲线
  13. centos系统查看系统版本、内核版本、系统位数、cpu个数、核心数、线程数
  14. 解决ios10以上H5页面手势、双击缩放问题
  15. 3.1.4 Spring的事务管理
  16. SpringMVC(十三) RequestMapping 使用servlet原生API作为参数
  17. 9.5 翻译系列:数据注解之ForeignKey特性【EF 6 Code-First系列】
  18. 一个Interface 继承多个Interface 的总结
  19. iOS10.0 &amp; Swift 3.0 对于升级项目的建议
  20. [报错] Xcode Error-Could not insert new outlet connection: Could not find any information for the class named &quot;xxx&quot;

热门文章

  1. Python小白学习之路(十三)—【递归调用】
  2. 初始化css文件
  3. c++类定义和类实现
  4. “context:include-filter”与“context:exclude-filter”标签作用解释
  5. 监督学习&mdash;&mdash;决策树理论与实践(上):分类决策树
  6. Karatsuba乘法--实现大数相乘
  7. python获取动态网站上面的动态加载的数据(selenium+Firefox)
  8. C/C++ -- Gui编程 -- Qt库的使用 -- 使用自定义类
  9. tensorflow summary
  10. PyCharm2018专业版激活步骤