<1>
S2SH web.xml内加载beans.xml配置出现了找不到jdbc.properties文件,问题如下:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/jdbc.properties]
...
Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/jdbc.properties]
web.xml内配置监听器加载:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<!-- <param-value>/WEB-INF/applicationContext*.xml</param-value>-->
<param-value>classpath:beans.xml</param-value>
</context-param>
第一反应是<param-value>内的值,即struts默认加载为WEB-INF下的一些配置文件,但是我不可能把jdbc.properties写到<param-value>内,找到beans.xml 找到
<beanclass="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>jdbc.properties</value>
</property>
</bean>
修改为:classpath:jdbc.properties 问题解决。
<2>
在struts2与spring整合的时候,struts2在初始化时候对相应的Action内部属性进行注入(从spring容器内进行匹配)操作,而sturts2-spring-pligin里struts.objectfactory.spring.autowire 内装配是默认以名称来:
故Action在spring容器内的名称尽量不要与其某属性的名称相同,否则会出现无法转换诡异错误。
实际上Action对象的产生是由strut2的 sturts2-spring-plugin 来管理的,但是其内部属性如UserManager之类是由插件从spring容器内部注入的,强制性 。。。也即strut2这边也有个专门存放Action的容器 ,由插件产生。。。
分享到:
相关推荐
S2SH整合S2SH整合S2SH整合S2SH整合S2SH整合S2SH整合S2SH整合
包含了s2sh 整合所用的所有jar包,适合eclipse中导入实用。
s2sh框架整合
S2SH框架整合 详细的步骤,即其中所需要的jar包
s2sh整合的完整代码,希望大家喜欢。里面包含了一些基本的有用的东西
s2sh框架整合类包
完整的S2SH框架整合, 带jar包 ,希望能够帮助你们
这个是s2sh开发所用的完整包,是从s2sh项目中的lib直接解压出来的,下载之后可以直接导入就可以用
S2SH框架整合增删改查源代码,适合于初学者入门
S2SH项目整合源码(spring4+struts2+hibernate4),包括增删改查和登录功能。
s2sh框架整合完整demo,可直接运行,含数据库建表sql 所采用的框架版本为:Struts 2.1.8, Sping2.5.5, Hibernate 3.5.6
s2sh整合annotation s2sh整合annotation s2sh整合annotation s2sh整合annotation s2sh整合annotation
针对S2SH框架整合的一个开发框架,包括BaseDaoImpl类的实现,包括PageBean 分页类,也包括Hibernate查询类QueryHelper,和前台的分页。是一个很不错的例子。 包括整合jar包。
S2SH整合实例S2SH整合实例S2SH整合实例
该资源包含了一个S2SH整合的完整代码,注释详细,简单易懂。
基于Annotation的s2sh整合配置实现分页功能基于Annotation的s2sh整合配置实现分页功能基于Annotation的s2sh整合配置实现分页功能基于Annotation的s2sh整合配置实现分页功能基于Annotation的s2sh整合配置实现分页功能
s2sh整合 源码 struts2 hibernate spring
s2sh注解整合,该注意的点都写的非常清楚。