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 ...
随机推荐
- java写hadoop全局排序
前言: 一直不会用java,都是streaming的方式用C或者python写mapper或者reducer的可执行程序.但是有些情况,如全排序等等用streaming的方式往往不好处理,于是乎用原生 ...
- 优化ubuntu桌面
---恢复内容开始--- 此博主写的很全 http://blog.csdn.net/terence1212/article/details/52270210 使用安装Unity Tweak Tool ...
- xxxxxxxxx
异步for (var index = 0; index < data.length; index++) { var req = http.request(urlEntity, function( ...
- 通过cpu SN码注册软件类
using System; using System.Management; namespace SoftReg { internal class SoftReg { #region 变量 ]; // ...
- Ubuntu中添加eclipse
环境:Ubuntu 14.04 步骤: 1.安装配置JDK,详见 http://my.oschina.net/u/1407116/blog/227084 2.下载eclipse 从官网http://w ...
- NSIS 的简介
NSIS (Nullsoft Scriptable Install System)是一个Open Source的Windows系统下安装程序制作程序.它提供了安装.卸载.系统设置.文件解压缩等功能.这 ...
- angular 国际化
今天mentor说让我看看angular国际化的问题,我看了看,发现这个帖子很有价值,但是手头上还有好几个issue没有解决,所以就先考皮在这将连接,解决完这几个bug我再去细细研究这个问题, htt ...
- poj 1185 (状压dp)
Problem 炮兵阵地 题目大意 给你一张n*m的地图,一些地区是空地,一些地区是障碍. 可以在空地上布置炮兵部队,炮兵部队的攻击范围为上下左右各两格. 询问最多可以布置多少个炮兵部队,且互不伤害. ...
- Android 学习第2课,下载 eclipse 工具
可以到http://www.ddooo.com/softdown/61745.htm 下载下来是32位与64位都有的 而且是汉化的,经测试成功,还可以,不错!
- tensorflow3
参考文献:tensorflow_manual_cn.pdf 一.tensorflow和caffe对应: graph-->.prototxt定义的网络结构 session-->solver( ...