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 ...
随机推荐
- css知识点积累
关于样式的优先级问题: !important > style > [ id > class > tag ]; z-index 的属性用法: z-index属性是用来设置元素的 ...
- oracle sql
show user desc 'table' SELECT DISTINCT SELECT * FROM emp WHERE comm is NOT NULL; SELECT * FROM emp W ...
- sql Sever的存储过程转换为mysql的
总体来说,sql sever和Mysql的存储过程的思路都是一样的,但是在语法和结构上还是有很大的区别的.1. 在mysql中写存储过程所有的dbo都要去掉.2. 每一个sql语句后面都需要加上:否则 ...
- 转: JSTL SQL标签库 使用
SQL标签库 JSTL提供了与数据库相关操作的标签,可以直接从页面上实现数据库操作的功能,在开发小型网站是可以很方便的实现数据的读取和操作.本章将详细介绍这些标签的功能和使用方法. SQL标签库从功能 ...
- Linux I2C总线设备驱动模型分析(ov7740)
1. 框架1.1 硬件协议简介1.2 驱动框架1.3 bus-drv-dev模型及写程序a. 设备的4种构建方法a.1 定义一个i2c_board_info, 里面有:名字, 设备地址 然后i2c_r ...
- html a 链接标签title属性换行鼠标悬停提示内容的换行效果
鼠标经过悬停于对象时提示内容(title属性内容)换行排版方法,html title 换行方法总结. html的title属性默认是显示一行的.如何换行呢? 这里DIVCSS5总结介绍两种换行方法为大 ...
- (转)oracle 存储过程 带游标作为OUT参数输出
(转)oracle 存储过程 带游标作为OUT参数输出 存储过程返回OUT参数的游标 例子. 包中带过程 要自己定义一个type [cur_name] is ref cursor游标,返回的时候就直接 ...
- python 的 *args 和 **kwargs
Python支持可变参数,通过*args和**kwargs来指定,示例如下: def test_kwargs(first, *args, **kwargs): print 'Required a ...
- 2014年4月份第2周51Aspx源码发布详情
HFC代码转化工具源码 2014-4-8 [VS2010]源码描述:HFC代码转化工具源码 1.主要实现HTML代码转化为C#或者JS代码,为我们平时编码节省时间. 2.把代码复制到面板上,通过右键 ...
- iOS运行时与method swizzling
C语言是静态语言,它的工作方式是通过函数调用,这样在编译时我们就已经确定程序如何运行的.而Objective-C是动态语言,它并非通过调用类的方 法来执行功能,而是给对象发送消息,对象在接收到消息之后 ...