当前位置: 代码迷 >> J2EE >> spring3 + dwr 如何能够配置成功
  详细解决方案

spring3 + dwr 如何能够配置成功

热度:472   发布时间:2016-04-22 00:13:19.0
spring3 + dwr 怎么能够配置成功
在网上搜了两三天了
发现自己总是配不成功
无数个报错信息
好不容易弄了个启动不报错的
可是这回执行的时候报空指针

目前项目使用的是注解的方式进行操作的
分为按照MVC的模式进行包的划分
数据库用mybatis支持

打算被dwr暴露的类是一个service中的类
该类执行数据库操作时使用了用@Autowired的dao类进行数据库操作

现在需要增加dwr的功能
可是怎么样都配置不成功
有没有可以在这种状况下配置成功啊?

具体的配置说明如下(原有配置,不包含dwr的配置信息):
web-info目录下有system-servlet.xml和web.xml两个文件
以上配置都已经是正常的可以使用的
web.xml

<filter>
<filter-name>Set Character Encoding</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>  
<servlet-name>system</servlet-name>  
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>  
<load-on-startup>1</load-on-startup>  
</servlet>
<servlet-mapping>  
<servlet-name>system</servlet-name>  
<url-pattern>*.html</url-pattern>  
</servlet-mapping>

以上是web.xml的部分配置信息,其他信息跟spring无关,故无需提供


system-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2010 The myBatis Team

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-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/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
     http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
  相关解决方案