@RemoteProxy()注释

dwr3.0可以通过全注解的方式,极大的简化了配置,所有xml配置加在一起不超过20行,而且使用更加简单,bean注入的问题也都解决。配置步骤如下:

web.xml的配置文件中,在默认的DispatcherServlet的mapping里加上dwr

<servlet>
        <servlet-name>appServlet</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/appServlet/appServlet-context.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

<servlet-mapping>
        <servlet-name>appServlet</servlet-name>
        <url-pattern>/dwr/*</url-pattern>
    </servlet-mapping>

dispatcherServlet的配置文件appServlet-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:dwr="http://www.directwebremoting.org/schema/spring-dwr"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.directwebremoting.org/schema/spring-dwr http://www.directwebremoting.org/schema/spring-dwr-3.0.xsd">
    <!-- DispatcherServlet Context: defines this servlet's request-processing
        infrastructure -->
    <!-- Enables the Spring MVC @Controller programming model -->
    <annotation-driven />
    <!-- Handles HTTP GET requests for /resources/** by efficiently serving
        up static resources in the ${webappRoot}/resources directory -->
    <resources mapping="/resources/**" location="/resources/" />
    <interceptors>
        <beans:bean class="com.panguso.op.data.manager.interceptor.LogInterceptor"></beans:bean>
    </interceptors>
    <!-- Resolves views selected for rendering by @Controllers to .jsp resources
        in the /WEB-INF/views directory -->
    <beans:bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <beans:property name="prefix" value="/WEB-INF/views/" />
        <beans:property name="suffix" value=".jsp" />
    </beans:bean>
    <!--<view-controller path="/" view-name="index" /> -->
    <context:component-scan base-package="com.panguso.op.data.manager" />

<!-- 从这行往下是要添加的 -->
    <context:annotation-config />
    <dwr:configuration />
    <dwr:annotation-config />
    <dwr:url-mapping />
    <dwr:controller id="dwrController" debug="true">
        <dwr:config-param name="allowScriptTagRemoting"
            value="true" />
        <dwr:config-param name="crossDomainSessionSecurity"
            value="false" />
    </dwr:controller>
    <beans:bean
        class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
        <beans:property name="order" value="1" />
    </beans:bean>
    <beans:bean
        class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
        <beans:property name="order" value="2" />
    </beans:bean>
    <!--添加结束-->
</beans:beans>

配置完毕,使用的方法和上文类似,注意的是@RemoteProxy标注的远程类一定要加上name属性,不然启动会报错,如:

@Service
@RemoteProxy(name = "GeneralContentManagementService")
public class GeneralContentManagementService { @RemoteMethod
public void aaa()
{
}
}

@RemoteProxy()注释 与@File注释的使用的更多相关文章

  1. NET中的规范标准注释(一) -- XML注释标签讲解

    一.摘要 .Net允许开发人员在源代码中插入XML注释,这在多人协作开发的时候显得特别有用. C#解析器可以把代码文件中的这些XML标记提取出来,并作进一步的处理为外部文档. 这篇文章将展示如何使用这 ...

  2. IntelliJ IDEA 如何设置类头注释和方法注释

    从VS转过来的,ide的差距很大的,所以...特意折腾了很久,结果还是没有VS的 '///' 好用 一.类头注释 打开file -> setting -> Editor -> Fil ...

  3. PhpStorm 头部注释、类注释和函数注释的设置

    *设置位置:"Settings"->"file templates"; 如下图,设置头部注释.类注释以及函数注释,时间.用户名.文件名称等随机改变的属性, ...

  4. 【Eclipse】如何在Eclipse中如何自动添加注释和自定义注释风格

    背景简介 丰富的注释和良好的代码规范,对于代码的阅读性和可维护性起着至关重要的作用.几乎每个公司对这的要求还是比较严格的,往往会形成自己的一套编码规范.但是再实施过程中,如果全靠手动完成,不仅效率低下 ...

  5. IntelliJ Idea注释模板--类注释、方法注释

    刚从Eclipse切换到IntelliJ Idea,之前使用eclipse时用到了注释模板,包括类注释和方法注释,现在分别讲一下在Intellij Idea中如何进行配置,作为备忘 一. 类注释模板配 ...

  6. 《从零开始学Swift》学习笔记(Day 57)——Swift编码规范之注释规范:文件注释、文档注释、代码注释、使用地标注释

    原创文章,欢迎转载.转载请注明:关东升的博客 前面说到Swift注释的语法有两种:单行注释(//)和多行注释(/*...*/).这里来介绍一下他们的使用规范. 1.文件注释 文件注释就在每一个文件开头 ...

  7. 使用.NET中的XML注释(一) -- XML注释标签讲解

    一.摘要 .Net允许开发人员在源代码中插入XML注释,这在多人协作开发的时候显得特别有用. C#解析器可以把代码文件中的这些XML标记提取出来,并作进一步的处理为外部文档. 这篇文章将展示如何使用这 ...

  8. Intellij IDEA设置类注释和方法注释

    背景:工欲善其事必先利其器,如果不能把工具用熟练了, 感觉很是别扭. 参考:IntelliJ IDEA设置类注释和方法注释 IntelliJ IDEA 中创建类的时候,可以直接自动给类加注释的设置,以 ...

  9. Idea 添加注释:类注释、方法注释(可获取参数)

    原文链接:https://blog.csdn.net/liqing0013/article/details/84104419 Idea 添加注释:类注释.方法注释 类注释 File–Setting–E ...

随机推荐

  1. phpcms调用语句

    title 标题:url 链接地址:thumb缩略图 :先调用moreinfo="1"  content 内容: {php list($copyfrom) = explode('| ...

  2. bui框架nav导航图标一览

    权限  .nav-permission   仓库  .nav-storage   库存  .nav-inventory   用户  .nav-user   订单  .nav-order   商品  . ...

  3. IDEA—— 找不到或无法加载主类Main

    最近使用idea,编写了一个项目,发现老是找不到main,网上找了一大圈的解决方案,都不行.灵机一动升级了jdk就可以了,之前用的是1.7的,换成了1.8的就好了.

  4. note 2 运算符和表达式

    运算符 +.-.*./ %求余Modulus **指数Exponent 表达式 #C = 5/9 (F - 32) print 5.0/9*(75-32) 自动类型转换 类型相同,结果类型不变 1/2 ...

  5. IDEA忽略某些文件

    Settings→Editor→File Types 在下方的忽略文件和目录(Ignore files and folders)中添加自己需要过滤的内容   下图为我自己添加过滤的内容,例如:*.im ...

  6. Linux集群之keepalive+Nginx

    集群从功能实现上分高可用和负载均衡: 高可用集群,即“HA"集群,也常称作“双机热备”. 当提供服务的机器宕机,备胎将接替继续提供服务: 实现高可用的开源软件有:heartbeat.keep ...

  7. Inception-v3的设计思路小结

    一.网络更深.更宽带来的问题 参数太多,若训练数据集有限,容易过拟合: 网络越大计算复杂度越大,难以应用:(内存和计算资源) 网络越深,梯度越往后穿越容易消失,难以优化模型. 解决: 如何减少参数(且 ...

  8. Vue中table表头合并的用法

    <div class="panel-container"> <div> <table class="table-head" wid ...

  9. MyISAM与InnoDB两者之间区别与选择,详细总结,性能对比

    1.MyISAM:默认表类型,它是基于传统的ISAM类型,ISAM是Indexed Sequential Access Method (有索引的顺序访问方法) 的缩写,它是存储记录和文件的标准方法.不 ...

  10. css:常见布局问题

    一.单列布局 1. 水平居中 1.1 使用inline-block和text-align .parent{text-align:center;} .child{display:inline-block ...