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 中获取所有的路由配置。的更多相关文章

  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. PHP 每天的总结(1)

    今天写博客的心情比以往还要糟糕,因为........................(完结). 1.获取某输入框的值,有两中获取方式,GET和POST .前者  没有为顾客的账户安全着想.而后者返之: ...

  2. Client默认用户及登录密码(转)

    Client默认用户及登录密码 SAP系统(如ERP.CRM等)安装完成,初始化状态下有若干个客户端(Client).如果是生产系统,一般只有000.001.066等三个Client:如果是IDES系 ...

  3. eventUtil

    var eventUtil = { // 添加句柄 addHandler: function(element, type, handler) { if(element.addEventListener ...

  4. 常用IT类英文词汇 - 1

    作为IT学生以及将来打算从事IT行业的人, 我们在开发时少不了要去阅读英文文档, 在面试及工作中也会涉及到相关的英文词汇, 因此具备一定的英语水准是必须的. 这里我就把我在学习中所遇到的英文词汇记录下 ...

  5. rails之 Migrations (转)

    1.简介 在rails中用migration可以很方便的管理数据库的结构.可以创建数据库,创建表,删除表,添加字段,删除字段,整理数据. migration就是一系列的class,这些类都继承了Act ...

  6. (转)深入理解JavaScript 模块模式

    深入理解JavaScript 模块模式 (原文)http://www.cnblogs.com/starweb/archive/2013/02/17/2914023.html 英文:http://www ...

  7. SVG 2D入门10 - 滤镜

    滤镜称得上是SVG最强大的功能了,它允许你给图形(图形元素和容器元素)添加各种专业软件中才有的滤镜特效.这样你就很容易在客户端生成和修改图像了.而且滤镜并没有破坏原有文档的结构,所以维护性也很好.   ...

  8. css&js实现顶部banner滚动提示效果

    以一个小例子来展示滚动提示的代码部分: try.html <div id="scrollobj" > <span class="scrollTxt&qu ...

  9. Win10/UWP新特性系列-GetPublisherCacheFolder

    微软Windows Runtime App拥有很强的安全模型来防止不同App之间的数据获取和共享,也就是我们所说的"沙盒机制",每个App都运行在Windows沙盒中,App之间的 ...

  10. NIC bonding

    Bonding is the same as port trunking. In the following I will use the word bonding because practical ...