依赖注入 抽象类
来源:互联网 发布:js 节点克隆 编辑:程序博客网 时间:2024/05/22 09:51
Spring配置Bean如下:
<bean id="Privilege" parent="txProxyTemplate">
<property name="target">
<bean class="com.langtoo.privilege.PrivilegeImpl">
<property name="userDao" ref="SysUserDao" />
</bean>
</property>
</bean>
txProxyTemplate 作用是继承 其他spring.xml中声明式事务的,这里关键注意的是 id ="Privilege" 和class = "com.langtoo.privilege.PrivilegeImpl"
下面采用 autowire=byName 方式来介绍经验,如果PrivilegeImpl.java 是 接口的实现类,那么就不会出错。
如果PrivilegeImpl.java 是 抽象类的实现类,编译时报异常:
Error creating bean with name 'Privilege' defined in class path resource [spring/spring-services-privilege.xml]: Invocation of init method failed; nested exception is org.springframework.aop.framework.AopConfigException: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
那么解决办法是:在ClassPath下添加cglib-2.1_3.jar包,我添加的是2.1_3的版本。
之后如果编译时继续报异常:
org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'Privilege' defined in class path resource [spring/spring-services-privilege.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type
那么解决办法是:在ClassPath下添加asm-1.5.3.jar包,我添加的是1.5.3的版本。
- 依赖注入 抽象类
- 依赖注入 接口 抽象
- 模拟spring依赖注入,自定义注入类
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 依赖注入
- 内核源码树目录下的Kconfig和Makefile。
- [转]STARTUP.A51中文说明
- 乔建军:代码跨平台,怎么就成了忽悠?
- uafxcw.lib(dllmodul.obj) : error LNK2005: DllMain already defined in
- Oracle错误一览表!
- 依赖注入 抽象类
- Linux管道命令
- PL/SQL Developer连接Oracle数据库,最简便的配置方法
- 1: 结构体对齐和#pragma page(N)的计算关系
- BitConverter----------拥有变量转换的类
- BitConverter----------拥有变量转换的类
- Flash/Flex与外部对象或数据交互的几种方式
- Lotus notes 开发IDE安装
- (转)STL总结