一、pom.xml

     <dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-spring-plugin</artifactId>
<version>2.3.15.3</version>
</dependency>

二、struts.xml

   <!-- struts.xml 使用spring工厂 -->
<constant name="struts.objectFactory" value="spring" />

org.apache.struts2.spring.StrutsSpringObjectFactory

action 应该托管给spring

struts2 action 中autowired 不能注入的更多相关文章

  1. struts2的action中@Autowired注入为null的解决方案

    今天遇到类似问题,记录下来以便以后查阅: @Aspect作用于action,致使action中的@Autowired注入为null的解决方案,以下三种任选一种: 1.去掉@Autowired,改用se ...

  2. 第三章Struts2 Action中动态方法调用、通配符的使用

    01.Struts 2基本结构 使用Struts2框架实现用登录的功能,使用struts2标签和ognl表达式简化了试图的开发,并且利用struts2提供的特性对输入的数据进行验证,以及访问Servl ...

  3. Struts2 Action中动态方法调用、通配符的使用

    一.Struts2执行过程图: 二.struts2配置文件的加载顺序 struts-default.xml---struts-plugin.xml---struts.xml 具体步骤: 三.Actio ...

  4. struts2 中属性驱动(其实就是struts2 action 中处理 request 的参数【old 方式servlet api 封装数据到javabean中(or beanutils)】),这里属性驱动是新方式

    1.属性驱动 a\  一般的set public class UserAction extends ActionSupport { private String username; private S ...

  5. struts2.Action中的method属性配置

    .Action中的method属性 在struts1.x中我们知道通过继承DispatchAction可以实现把多个Action进行统一操作,在struts2中实现action的统一操作也很简单.我们 ...

  6. Struts2 Action中的方法命名不要以get开头

    偶然发现,在调用一个action中的某个方法时,会自动调用另一个无关的方法,找了好久,最后发现是方法命名的问题,方法命名以get开头,action会自动调用!所以,以后再写action中的方法时尽量不 ...

  7. 将 jsp 页面的值 传到struts2 action中(不是表单中的值)

    JSP: 页面: <%@ page language="java"  pageEncoding="GBK"%> <%@taglib prefi ...

  8. 在Struts2 Action中快速简便的访问Request、Session等变量

    前言——正常情况下如何在Action中获取到这些变量 全部方法(共四种)可以参考:http://blog.csdn.net/itmyhome1990/article/details/7019476 这 ...

  9. listener中@Autowired无法注入bean的一种解决方法

    背景:使用监听器处理业务,需要使用自己的service方法: 错误:使用@Autowired注入service对象,最终得到的为null: 原因:listener.fitter都不是Spring容器管 ...

随机推荐

  1. autolayout不work

    对于代码创建的UIView,将下面的选项关掉 [label3 setTranslatesAutoresizingMaskIntoConstraints:NO];

  2. centos 安装单机版 redis4.0.10

    redis源码地址: http://download.redis.io/releases/ 下载 redis-4.0.10.tar.gz  和  redis-stable.tar.gz 第一步:安装g ...

  3. Haskell语言学习笔记(22)MaybeT

    Monad Transformers Monad 转换器用于将两个不同的Monad合成为一个Monad.Monad 转换器本身也是一个 Monad. MaybeT MaybeT 这个 Monad 转换 ...

  4. whlie and for

    public class TestWhileAndFor { /**测试 while和for循环练习 * 100 以内的奇数和偶数的和 * @author Administrator * */ pub ...

  5. mysql备份和还原命令

    备份和还原数据库都是在未登录的前提下进行命令操作的: 1.备份表: mysqldump -u root -p dbname table1 table2 > D:\sqlback.sql 2.备份 ...

  6. 吴裕雄 数据挖掘与分析案例实战(5)——python数据可视化

    # 饼图的绘制# 导入第三方模块import matplotlibimport matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['S ...

  7. scikit Flow ,tensor flow 做ml模型

    [https://github.com/ilblackdragon/tf_examples/blob/master/titanic.py] [keras 高层tensorflow] https://k ...

  8. rsa 公钥 私钥

    如果用于加密解密,那就是用公钥加密私钥解密(仅你可读但别人不可读,任何人都可写)如果用于证书验证,那就是用私钥加密公钥解密(仅你可写但别人不可写,任何人都可读) 最后,RSA的公钥.私钥是互相对应的. ...

  9. php拓展安装

    Yaf安装配置:http://www.laruence.com/manual/yaf.install.html#yaf.installation.linux 下载Yaf的最新版本, 解压缩以后, 进入 ...

  10. cdoj203-Islands 【并查集】

    http://acm.uestc.edu.cn/#/problem/show/203 Islands Time Limit: 30000/10000MS (Java/Others)     Memor ...