SpringMVC 中获取所有的路由配置。
ApplicationContext context = TMSContextLookup.getApplicationContext();
String[] controllerList = context.getBeanNamesForAnnotation(Controller.class);
for(String name : controllerList){
try {
Object bean = context.getBean(name);
String preFix = "";
RequestMapping clazzRequestMapping = bean.getClass().getAnnotation(RequestMapping.class);
if (clazzRequestMapping!=null && !TMSUtil.isEmpty(clazzRequestMapping.value())){
preFix = clazzRequestMapping.value()[0];
}
Method[] method = bean.getClass().getDeclaredMethods();
if (method!=null){
for (Method m :method){
RequestMapping mRequestMapping = m.getAnnotation(RequestMapping.class);
if (mRequestMapping!=null && !TMSUtil.isEmpty(mRequestMapping.value())){
String path = mRequestMapping.value()[0];
System.out.println(preFix + "/" + path);
}
}
}
}catch (Exception e){
System.out.println(e.getMessage());
}
}
SpringMVC 中获取所有的路由配置。的更多相关文章
- springMVC中获取request和response对象的几种方式(RequestContextHolder)
springMVC中获取request和response对象的几种方式 1.最简单方式:参数 2.加入监听器,然后在代码里面获取 原文链接:https://blog.csdn.net/weixin_4 ...
- 在过滤器中获取在web.xml配置的初始化参数
在过滤器中获取在web.xml配置的初始化参数 例如 <filter> <filter-name>cross-origin</filter-name> < ...
- 在Springmvc中获取properties属性
一些关键的属性一般都会拿出来作为配置,比如数据库连接等.在springmvc中也提供了获取property的类,比如@Value来获取.我接触spring很浅,基本上都是百度的问题解决方法,百度到@v ...
- 在SpringMVC中获取request对象
1.注解法 @Autowired private HttpServletRequest request; 2. 在web.xml中配置一个监听 <listener> <listen ...
- 在SpringMVC中获取request对象的几种方式
1.最简单的方式(注解法) @Autowired private HttpServletRequest request; 2.最麻烦的方法 a. 在web.xml中配置一个监听 <listene ...
- springmvc中获取request对象,加载biz(service)的方法
获取request对象: 首先配置web.xml文件--> <listener> <listener-class> org.springframework.web.con ...
- SpringMvc中获取Request
Controller中加参数 @Controller public class TestController { @RequestMapping("/test") public v ...
- 如何在SpringMVC中获取request对象
1.注解法 @Autowired private HttpServletRequest request; <listener> <listener-class> org.spr ...
- 不用@Value从Spring的ApplicationContext中获取一个或全部配置
获取一个配置: applicationContext.getEnvironment().resolvePlaceholders("${propertyKey}"); // 方法1 ...
随机推荐
- DbUtils常用API的使用 方便以后查阅
package com.lizhou.Test; import java.sql.SQLException; import java.util.List; import java.util.Map; ...
- <li>高度自适应
使用ul和li代替表格进行排版的时候,会发现li无法自适应高度. 只需要将li的overflow置为auto就可以了,因为li默认的overflow是visible,会将内部元素显示在li之外. ...
- 升级设置win2008r2开发环境,遇到问题小结
升级设置2008r2开发环境,是一般程序员经历的事情.许多从vs 2003,vs2005+sql2000+win2003过来,但是,时间推移,技术革新,64位的推行.架构的变化和强大.我们也只可以学习 ...
- 搭建Android工程的步骤及其第一个安卓程序
1.安卓系统架构 1>底层是Linux系统 2>函数库层 由C或C++写的 3>Application frameWork应用的框架层 4>顶层是应用层 2.JVM与DVM介绍 ...
- webshell
webshell就是以asp.php.jsp或者cgi等网页文件形式存在的一种命令执行环境,也可以将其称做为一种网页后门.黑客在入侵了一个网站后,通常会将asp或php后门文件与网站服务器WEB目录下 ...
- iOS学习之六种传值方式
iOS页面传值方式 应用于: 两个互动的界面:1)页面一跳转到页面二,页面一的textField的值传给页面二的label.2)A页面跳转到B页面,B页面再跳转回A页面(注册页面跟登录页面) 两个不互 ...
- 实现Android4.4系统设置分页滑动浏览功能
需求描述: 由于手机功能越来越完善,相应的偏好设置也就越来越多:从用户体验的角度考虑,为了让用户能够在短时间内对常用的偏好设置进行操作,如WIFI,蜂窝数据等.单独将一些常用的设置功能单独展示出来,已 ...
- Android 学习第3课,小例子
package temperature.convert; import java.util.Scanner; public class Converter { public static void m ...
- C++学习笔记24:makefile文件
makefile make命令:负责c/c++程序编译与链接 make根据指定命令进行建构 建构规则文件:GNUmakefile , makefile,Makefile makefile 文件格式 m ...
- linux,python 常用的处理log的命令
一般的log文件都是需要过滤 ps:管道符| 管道符前面的输出值 grep 过滤查找 将是error的log过滤显示 grep '221.2.100.138' web.access.log gr ...