Spring中Bean工厂模式的改进  被引量:3

IMPROVEMENT OF BEANFACTORY PATTERN IN SPRING

在线阅读下载全文

作  者:夏龄[1] 

机构地区:[1]四川民族学院网络信息中心,四川康定626001

出  处:《计算机应用与软件》2012年第11期165-167,238,共4页Computer Applications and Software

基  金:四川省教育厅科研基金项目(10ZC025)

摘  要:主要利用Java泛型编程将泛型机制与设计模式有机地结合并加以优化和实现,提出一种基于Java泛型类型(generictype)的类型转换方案,在工厂设计模式或其他应用中可有效摆脱类型强制转换或向下类型转换的过程中极容易发生错误的情况。并针对Spring中强制类型转换工厂进行改进,在利用工厂获得某个类的实例时不需要硬编码的方式强制转换实例的类型。该改进提高了软件体系结构的可扩展性,为程序设计者提供了方便。最后,通过实际编程验证了该方案的有效性以及在类型转换中的优越性。In this paper we mainly use Java generic programming to integrate the generic mechanism with design patterns in organic way and realise as well as optimise it.We propose a new class cast scheme which is based on Java generic types,to use the scheme in factory design pattern or other types of applications can effectively get rid of the error situations which are prone to incur in the process of either mandatory class cast or downward class cast.Moreover,we make the improvement in light of the mandatory class cast factory in Spring,when getting a certain instance of class with factory,it does not need the class of mandatory cast instance through hard code manner.The scheme improves the scalability of the software architecture,and provides convenience to programmers.Finally,the actual programming experiment results demonstrate its effectiveness and superiority of the scheme in class cast.

关 键 词:泛型 泛型编程 工厂模式 XML 

分 类 号:TP311[自动化与计算机技术—计算机软件与理论]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象