计算机专业论文译文Spring框架Word格式.docx

上传人:b****3 文档编号:17578721 上传时间:2022-12-07 格式:DOCX 页数:10 大小:27.85KB
下载 相关 举报
计算机专业论文译文Spring框架Word格式.docx_第1页
第1页 / 共10页
计算机专业论文译文Spring框架Word格式.docx_第2页
第2页 / 共10页
计算机专业论文译文Spring框架Word格式.docx_第3页
第3页 / 共10页
计算机专业论文译文Spring框架Word格式.docx_第4页
第4页 / 共10页
计算机专业论文译文Spring框架Word格式.docx_第5页
第5页 / 共10页
点击查看更多>>
下载资源
资源描述

计算机专业论文译文Spring框架Word格式.docx

《计算机专业论文译文Spring框架Word格式.docx》由会员分享,可在线阅读,更多相关《计算机专业论文译文Spring框架Word格式.docx(10页珍藏版)》请在冰豆网上搜索。

计算机专业论文译文Spring框架Word格式.docx

TheORMpackageprovidesintegrationlayersforpopularobject-relationalmappingAPIs,includingJDO,HibernateandiBatis.UsingtheORMpackageyoucanuseallthoseO/R-mappersincombinationwithalltheotherfeaturesSpringoffers,likesimpledeclarativetransactionmanagementmentionedbefore.

Spring'

sAOPpackageprovidesanAOPAlliancecompliantaspect-orientedprogrammingimplementationallowingyoutodefine,forexample,method-interceptorsandpointcutstocleanlydecouplecodeimplementingfunctionalitythatshouldlogicallyspeakingbeseparated.Usingsource-levelmetadatafunctionalityyoucanincorporateallkindsofbehavioralinformationintoyourcode,alittlelike.NETattributes.

sWebpackageprovidesbasicweb-orientedintegrationfeatures,suchasmultipartfunctionality,initializationofcontextsusingservletlistenersandaweb-orientedapplicationcontext.WhenusingSpringtogetherwithWebWorkorStruts,thisisthepackagetointegratewith.

sWebMVCpackageprovidesaModel-View-Controllerimplementationforweb-applications.Spring'

sMVCimplementationisnotjustanyimplementation,itprovidesacleanseparationbetweendomainmodelcodeandwebformsandallowsyoutousealltheotherfeaturesoftheSpringFrameworklikevalidation.

swebMVCframeworkisdesignedaroundaDispatcherServletthatdispatchesrequeststohandlers,withconfigurablehandlermappings,viewresolution,localeandthemeresolutionaswellassupportforuploadfiles.ThedefaulthandlerisaverysimpleControllerinterface,justofferingaModelAndViewhandleRequest(request,response)method.Thiscanalreadybeusedforapplicationcontrollers,butyouwillprefertheincludedimplementationhierarchy,consistingof,forexampleAbstractController,AbstractCommandControllerandSimpleFormController.Applicationcontrollerswilltypicallybesubclassesofthose.Notethatyoucanchooseanappropriatebaseclass:

Ifyoudon'

thaveaform,youdon'

tneedaFormController.ThisisamajordifferencetoStruts.

Youcanuseanyobjectasacommandorformobject-there'

snoneedtoimplementaninterfaceorderivefromabaseclass.Spring'

sdatabindingishighlyflexible,forexample,ittreatstypemismatchesasvalidationerrorsthatcanbeevaluatedbytheapplication,notassystemerrors.Soyoudon'

tneedtoduplicateyourbusinessobjects'

propertiesasStringsinyourformobjects,justtobeabletohandleinvalidsubmissions,ortoconverttheStringsproperly.Instead,itisoftenpreferabletobinddirectlytoyourbusinessobjects.ThisisanothermajordifferencetoStrutswhichisbuiltaroundrequiredbaseclasseslikeActionandActionForm-foreverytypeofaction.

ComparedtoWebWork,Springhasmoredifferentiatedobjectroles.ItsupportsthenotionofaController,anoptionalcommandorformobject,andamodelthatgetspassedtotheview.Themodelwillnormallyincludethecommandorformobjectbutalsoarbitraryreferencedata.Instead,aWebWorkActioncombinesallthoserolesintoonesingleobject.WebWorkdoesallowyoutouseexistingbusinessobjectsaspartofyourform,butonlybymakingthembeanpropertiesoftherespectiveActionclass.Finally,thesameActioninstancethathandlestherequestisusedforevaluationandformpopulationintheview.Thus,referencedataneedstobemodeledasbeanpropertiesoftheActiontoo.Thesearearguablytoomanyrolesforoneobject.

sviewresolutionisextremelyflexible.AControllerimplementationcanevenwriteaviewdirectlytotheresponse,returningnullasModelAndView.Inthenormalcase,aModelAndViewinstanceconsistsofaviewnameandamodelMap,containingbeannamesandcorrespondingobjects(likeacommandorform,containingreferencedata).Viewnameresolutionishighlyconfigurable,eitherviabeannames,viaapropertiesfile,orviayourownViewResolverimplementation.TheabstractmodelMapallowsforcompleteabstractionoftheviewtechnology,withoutanyhassle.Anyrenderercanbeintegrateddirectly,whetherJSP,Velocity,oranyotherrenderingtechnology.ThemodelMapissimplytransformedintoanappropriateformat,suchasJSPrequestattributesoraVelocitytemplatemodel..

PluggabilityofotherMVCimplementations

ThereareseveralreasonswhysomeprojectswillprefertouseotherMVCimplementations.Manyteamsexpecttoleveragetheirexistinginvestmentinskillsandtools.Inaddition,thereisalargebodyofknowledgeandexperienceavalailablefortheStrutsframework.Thus,ifyoucanlivewithStruts'

architecturalflaws,itcanstillbeaviablechoicefortheweblayer.ThesameappliestoWebWorkandotherwebMVCframeworks.

Ifyoudon'

twanttouseSpring'

swebMVC,butintendtoleverageothersolutionsthatSpringoffers,youcanintegratethewebMVCframeworkofyourchoicewithSpringeasily.SimplystartupaSpringrootapplicationcontextviaitsContextLoaderListener,andaccessitviaitsServletContextattribute(orSpring'

srespectivehelpermethod)fromwithinaStrutsorWebWorkaction.Notethattherearen'

tany"

plugins"

involved,sonodedicatedintegrationisnecessary.Fromtheweblayer'

spointofview,you'

llsimplyuseSpringasalibrary,withtherootapplicationcontextinstanceastheentrypoint.

AllyourregisteredbeansandallofSpring'

sservicescanbeatyourfingertipsevenwithoutSpring'

swebMVC.Springdoesn'

tcompetewithStrutsorWebWorkinthisscenario,itjustaddressesthemanyareasthatthepurewebMVCframeworksdon'

t,frombeanconfigurationtodataaccessandtransactionhandling.SoyouareabletoenrichyourapplicationwithaSpringmiddletierand/ordataaccesstier,evenifyoujustwanttouse,forexample,thetransactionabstractionwithJDBCorHibernate.

FeaturesofSpringMVC

swebmoduleprovidesawealthofuniquewebsupportfeatures,including:

Clearseparationofroles-controller,validator,commandobject,formobject,modelobject,DispatcherServlet,handlermapping,viewresolver,etc.Eachrolecanbefulfilledbyaspecializedobject.

PowerfulandstraightforwardconfigurationofbothframeworkandapplicationclassesasJavaBeans,includingeasyreferencingacrosscontexts,suchasfromwebcontrollerstobusinessobjectsandvalidators.

Adaptability,non-intrusiveness.Usewhatevercontrollersubclassyouneed(plain,command,form,wizard,multi-action,oracustomone)foragivenscenarioinsteadofderivingfromasinglecontrollerforeverything.

Reusablebusinesscode-noneedforduplication.Youcanuseexistingbusinessobjectsascommandorformobjectsinsteadofmirroringtheminordertoextendaparticularframeworkbaseclass.

Customizablebindingandvalidation-typemismatchesasapplication-levelvalidationerrorsthatkeeptheoffendingvalue,localizeddateandnumberbinding,etcinsteadofString-onlyformobjectswithmanualparsingandconversiontobusinessobjects.

Customizablehandlermappingandviewresolution-handlermappingandviewresolutionstrategiesrangefromsimpleURL-basedconfiguration,tosophisticated,purpose-builtresolutionstrategies.ThisismoreflexiblethansomewebMVCframeworkswhichmandateaparticulartechnique.

Flexiblemodeltransfer-modeltransferviaaname/valueMapsupportseasyintegrationwithanyviewtechnology.

Customizablelocaleandthemeresolution,supportforJSPswithorwithoutSpringtaglibrary,supportforJSTL,supportforVelocitywithouttheneedforextrabridges,etc.

AsimplebutpowerfultaglibrarythatavoidsHTMLgenerationatanycost,allowingformaximumflexibilityintermsofmarkupcode.

DataAccessusingO/RMappers

SpringprovidesintegrationwithHibernate,JDO,OracleTopLink,ApacheOJBandiBATISSQLMaps:

intermsofresourcemanagement,DAOimplementationsupport,andtransactionstrategies.ForexampleforHibernate,thereisfirst-classsupportwithlotsofIoCconveniencefeatures,addressingmanytypicalHibernateintegrationissues.AllofthesesupportpackagesforO/RmapperscomplywithSpring'

sgenerictransactionandDAOexceptionhierarchies.Thereareusuallytwointegrationstyles:

eitherusingSpring'

sDAO'

templates'

orcodingDAOsagainstplainHibernate/JDO/TopLink/etcAPIs.Inbothcases,DAOscanbeconfiguredthroughDependencyInjectionandparticipateinSpring'

sresourceandtransactionmanagement.

saddssignificantsupportwhenusingtheO/Rmapp

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 自然科学 > 生物学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1