1. ApplicationContext context = TMSContextLookup.getApplicationContext();
  2.  
  3. String[] controllerList = context.getBeanNamesForAnnotation(Controller.class);
  4. for(String name : controllerList){
  5. try {
  6. Object bean = context.getBean(name);
  7. String preFix = "";
  8. RequestMapping clazzRequestMapping = bean.getClass().getAnnotation(RequestMapping.class);
  9. if (clazzRequestMapping!=null && !TMSUtil.isEmpty(clazzRequestMapping.value())){
  10. preFix = clazzRequestMapping.value()[0];
  11. }
  12.  
  13. Method[] method = bean.getClass().getDeclaredMethods();
  14. if (method!=null){
  15. for (Method m :method){
  16. RequestMapping mRequestMapping = m.getAnnotation(RequestMapping.class);
  17. if (mRequestMapping!=null && !TMSUtil.isEmpty(mRequestMapping.value())){
  18. String path = mRequestMapping.value()[0];
  19. System.out.println(preFix + "/" + path);
  20. }
  21. }
  22. }
  23. }catch (Exception e){
  24. System.out.println(e.getMessage());
  25. }
  26. }

  

SpringMVC 中获取所有的路由配置。的更多相关文章

  1. springMVC中获取request和response对象的几种方式(RequestContextHolder)

    springMVC中获取request和response对象的几种方式 1.最简单方式:参数 2.加入监听器,然后在代码里面获取 原文链接:https://blog.csdn.net/weixin_4 ...

  2. 在过滤器中获取在web.xml配置的初始化参数

    在过滤器中获取在web.xml配置的初始化参数   例如 <filter> <filter-name>cross-origin</filter-name> < ...

  3. 在Springmvc中获取properties属性

    一些关键的属性一般都会拿出来作为配置,比如数据库连接等.在springmvc中也提供了获取property的类,比如@Value来获取.我接触spring很浅,基本上都是百度的问题解决方法,百度到@v ...

  4. 在SpringMVC中获取request对象

    1.注解法 @Autowired private  HttpServletRequest request; 2. 在web.xml中配置一个监听 <listener> <listen ...

  5. 在SpringMVC中获取request对象的几种方式

    1.最简单的方式(注解法) @Autowired private HttpServletRequest request; 2.最麻烦的方法 a. 在web.xml中配置一个监听 <listene ...

  6. springmvc中获取request对象,加载biz(service)的方法

    获取request对象: 首先配置web.xml文件--> <listener> <listener-class> org.springframework.web.con ...

  7. SpringMvc中获取Request

    Controller中加参数 @Controller public class TestController { @RequestMapping("/test") public v ...

  8. 如何在SpringMVC中获取request对象

    1.注解法 @Autowired private HttpServletRequest request; <listener> <listener-class> org.spr ...

  9. 不用@Value从Spring的ApplicationContext中获取一个或全部配置

    获取一个配置: applicationContext.getEnvironment().resolvePlaceholders("${propertyKey}"); // 方法1 ...

随机推荐

  1. css知识点积累

    关于样式的优先级问题: !important > style > [ id > class > tag ];  z-index 的属性用法: z-index属性是用来设置元素的 ...

  2. oracle sql

    show user desc 'table' SELECT DISTINCT SELECT * FROM emp WHERE comm is NOT NULL; SELECT * FROM emp W ...

  3. sql Sever的存储过程转换为mysql的

    总体来说,sql sever和Mysql的存储过程的思路都是一样的,但是在语法和结构上还是有很大的区别的.1. 在mysql中写存储过程所有的dbo都要去掉.2. 每一个sql语句后面都需要加上:否则 ...

  4. 转: JSTL SQL标签库 使用

    SQL标签库 JSTL提供了与数据库相关操作的标签,可以直接从页面上实现数据库操作的功能,在开发小型网站是可以很方便的实现数据的读取和操作.本章将详细介绍这些标签的功能和使用方法. SQL标签库从功能 ...

  5. Linux I2C总线设备驱动模型分析(ov7740)

    1. 框架1.1 硬件协议简介1.2 驱动框架1.3 bus-drv-dev模型及写程序a. 设备的4种构建方法a.1 定义一个i2c_board_info, 里面有:名字, 设备地址 然后i2c_r ...

  6. html a 链接标签title属性换行鼠标悬停提示内容的换行效果

    鼠标经过悬停于对象时提示内容(title属性内容)换行排版方法,html title 换行方法总结. html的title属性默认是显示一行的.如何换行呢? 这里DIVCSS5总结介绍两种换行方法为大 ...

  7. (转)oracle 存储过程 带游标作为OUT参数输出

    (转)oracle 存储过程 带游标作为OUT参数输出 存储过程返回OUT参数的游标 例子. 包中带过程 要自己定义一个type [cur_name] is ref cursor游标,返回的时候就直接 ...

  8. python 的 *args 和 **kwargs

    Python支持可变参数,通过*args和**kwargs来指定,示例如下: def test_kwargs(first, *args, **kwargs):    print 'Required a ...

  9. 2014年4月份第2周51Aspx源码发布详情

    HFC代码转化工具源码  2014-4-8 [VS2010]源码描述:HFC代码转化工具源码 1.主要实现HTML代码转化为C#或者JS代码,为我们平时编码节省时间. 2.把代码复制到面板上,通过右键 ...

  10. iOS运行时与method swizzling

    C语言是静态语言,它的工作方式是通过函数调用,这样在编译时我们就已经确定程序如何运行的.而Objective-C是动态语言,它并非通过调用类的方 法来执行功能,而是给对象发送消息,对象在接收到消息之后 ...