毕业论文外文翻译-Spring 框架简介.docx
- 文档编号:1930255
- 上传时间:2023-05-02
- 格式:DOCX
- 页数:25
- 大小:32.65KB
毕业论文外文翻译-Spring 框架简介.docx
《毕业论文外文翻译-Spring 框架简介.docx》由会员分享,可在线阅读,更多相关《毕业论文外文翻译-Spring 框架简介.docx(25页珍藏版)》请在冰点文库上搜索。
IntroducingtheSpringFramework
TheSpringFramework:
apopularopensourceapplicationframeworkthataddressesmanyoftheissuesoutlinedinthisbook.ThischapterwillintroducethebasicideasofSpringanddis-cussthecentral"beanfactory"lightweightInversion-of-Control(loC)containerindetail.
Springmakesitparticularlyeasytoimplementlightweight,yetextensible,J2EEarchi-tectures.Itprovidesanout—of—the—boximplementationofthefundamentalarchitecturalbuildingblockswerecommend.Springprovidesaconsistentwayofstructuringyourapplications,andprovidesnumerousmiddletierfeaturesthatcanmakeJ2EEdevelopmentsignificantlyeasierandmoreflexiblethanintraditionalapproaches.
ThebasicmotivationsforSpringare:
Toaddressareasnotwellservedbyotherframeworks.TherearenumerousgoodsolutionstospecificareasofJ2EEinfrastructure:
webframeworks,persistencesolutions,remotingtools,andsoon.However,integratingthesetoolsintoacomprehensivearchitecturecaninvolvesignificanteffort,andcanbecomeaburden.Springaimstoprovideanend-to-endsolution,integratingspe-cializedframeworksintoacoherentoverallinfrastructure.Springalsoaddressessomeareasthatotherframeworksdon't.Forexample,fewframeworksaddressgenerictransactionmanagement,dataaccessobjectimplementation,andgluingallthosethingstogetherintoanapplication,whilestillallowingforbest-of-breedchoiceineacharea.HencewetermSpringanapplicationframework,ratherthanawebframework,loCorAOPframework,orevenmiddletierframework.
Toallowforeasyadoption.Aframeworkshouldbecleanlylayered,allowingtheuseofindi-vidualfeatureswithoutimposingawholeworldviewontheapplication.ManySpringfeatures,suchastheJDBCabstractionlayerorHibernateintegration,canbeusedinalibrarystyleoraspartoftheSpringend-to-endsolution.
Todelivereaseofuse.Aswe'venoted,J2EEoutoftheboxisrelativelyhardtousetosolvemanycommonproblems.Agoodinfrastructureframeworkshouldmakesimpletaskssimpletoachieve,withoutforcingtradeoffsforfuturecomplexrequirements(likedistributedtransactions)ontheapplicationdeveloper.ItshouldallowdeveloperstoleverageJ2EEservicessuchasJTAwhereappropriate,buttoavoiddependenceonthemincaseswhentheyareunnecessarilycomplex.
Tomakeiteasiertoapplybestpractices.Springaimstoreducethecostofadheringtobestpracticessuchasprogrammingtointerfaces,ratherthanclasses,almosttozero.However,itleavesthechoiceofarchitecturalstyletothedeveloper.
Non-invasiveness.Applicationobjectsshouldhaveminimaldependenceontheframework.IfleveragingaspecificSpringfeature,anobjectshoulddependonlyonthatparticularfeature,whetherbyimplementingacallbackinterfaceorusingtheframeworkasaclasslibrary.loCandAOParethekeyenablingtechnologiesforavoidingframeworkdependence.
Consistentconfiguration.Agoodinfrastructureframeworkshouldkeepapplicationconfigurationflexibleandconsistent,avoidingtheneedforcustomsingletonsandfactories.Asinglestyleshouldbeapplicabletoallconfigurationneeds,fromthemiddletiertowebcontrollers.
Easeoftesting.Testingeitherwholeapplicationsorindividualapplicationclassesinunittestsshouldbeaseasyaspossible.Replacingresourcesorapplicationobjectswithmockobjectsshouldbestraightforward.
Toallowforextensibility.BecauseSpringisitselfbasedoninterfaces,ratherthanclasses,itiseasytoextendorcustomizeit.
ManySpringcomponentsusestrategyinterfaces,allowingeasycustomization.
ALayeredApplicationFramework
Chapter6introducedtheSpringFrameworkasalightweightcontainer,competingwithloCcontainerssuchasPicoContainer.WhiletheSpringlightweightcontainerforJavaBeansisacoreconcept,thisisjustthefoundationforasolutionforallmiddlewarelayers.
BasicBuildingBlocks
pringisafull-featuredapplicationframeworkthatcanbeleveragedatmanylevels.Itconsistsofmulti-plesub-frameworksthatarefairlyindependentbutstillintegratecloselyintoaone-stopshop,ifdesired.Thekeyareasare:
Beanfactory.TheSpringlightweightloCcontainer,capableofconfiguringandwiringupJava-BeansandmostplainJavaobjects,removingtheneedforcustomsingletonsandadhocconfigura-1ion.Variousout-of—the—boximplementationsincludeanXML-basedbeanfactory.ThelightweightloCcontaineranditsDependencyInjectioncapabilitieswillbethemainfocusofthischapter.
Applicationcontext.ASpringapplicationcontextextendsthebeanfactoryconceptbyaddingsupportformessagesourcesandresourceloading,andprovidinghooksintoexistingenviron-ments.Variousout-of-the~boximplementationsincludestandaloneapplicationcontextsandanXML-basedwebapplicationcontext.
AOPframework.TheSpringAOPframeworkprovidesAOPsupportformethodinterceptiononanyclassmanagedbyaSpringlightweightcontainer.Itsupportseasyproxyingofbeansinabeanfactory,seamlesslyweavingininterceptorsandotheradviceatruntime.Chapter8dis-cussestheSpringAOPframeworkindetail.ThemainuseoftheSpringAOPframeworkistoprovidedeclarativeenterpriseservicesforPOJOs.
Auto-proxying.SpringprovidesahigherlevelofabstractionovertheAOPframeworkandlow-levelservices,whichofferssimilarease—of—useto.NETwithinaJ2EEcontext.Inparticular,theprovisionofdeclarativeenterpriseservicescanbedrivenbysource-levelmetadata.
Transactionmanagement.Springprovidesagenerictransactionmanagementinfrastructure,withpluggabletransactionstrategies(suchasJTAandJDBC)andvariousmeansfordemarcat-ingtransactionsinapplications.Chapter9discussesitsrationaleandthepowerandflexibilitythatitoffers.
DAOabstraction.Springdefinesasetofgenericdataaccessexceptionsthatcanbeusedforcre-atinggenericDAOinterfacesthatthrowmeaningfulexceptionsindependentoftheunderlyingpersistencemechanism.Chapter10illustratestheSpringsupportforDAOsinmoredetail,examiningJDBC,JDO,andHibernateasimplementationstrategies.
JDBCsupport.SpringofferstwolevelsofJDBCabstractionthatsignificantlyeasetheeffortofwritingJDBC-basedDAOs:
theorg.springframework,jdbc.corepackage(atemplate/
callbackapproach)andtheorg.springframework.jdbc.objectpackage(modelingRDBMSoperationsasreusableobjects).UsingtheSpringJDBCpackagescandelivermuchgreaterpro~ductivityandeliminatethepotentialforcommonerrorssuchasleakedconnections,comparedwithdirectuseofJDBC.TheSpringJDBCabstractionintegrateswiththetransactionandDAOabstractions.
Integrationwith0/Rmappingtools.Springprovidessupportclassesfor0/RMappingtoolslikeHibernate,JDO,andiBATISDatabaseLayertosimplifyresourcesetup,acquisition,andrelease,andtointegratewiththeoveralltransactionandDAOabstractions.TheseintegrationpackagesallowapplicationstodispensewithcustomThreadLocalsessionsandnativetransac-tionhandling,regardlessoftheunderlying0/Rmappingapproachtheyworkwith.
WebMVCframework.SpringprovidesacleanimplementationofwebMVC,consistentwiththeJavaBeanconfigurationapproach.TheSpringwebframeworkenableswebcontrollerstobeconfiguredwithinanloCcontainer,eliminatingtheneedtowriteanycustomcodetoaccessbusinesslayerservices.ItprovidesagenericDispatcherServletandout-of-the—boxcontrollerclassesforcommandandformhandling.Request-to—controllermapping,viewresolution,localeresolutionandotherimportantservicesareallpluggable,makingtheframeworkhighlyextensi-ble.ThewebframeworkisdesignedtoworknotonlywithJSP,butwithanyviewtechnology,suchasVelocity一withouttheneedforadditionalbridges.Chapter13discusseswebtierdesignandtheSpringwebMVCframeworkindetail.
Remotingsupport.Springprovidesathinabstractionlayerforaccessingremoteserviceswithouthard-codedlookups,andforexposingSpring-managedapplicationbeansasremoteservices.Out-of-the—boxsupportisincludedforRMI,Caucho'sHessianandBurlapwebserviceprotocols,andWSDLWebServicesviaJAX-RPC.Chapter11discusseslightweightremoting.
WhileSpringaddressesareasasdiverseastransactionmanagementandwebMVC,itusesaconsistentapproacheverywhere.Onceyouhavelearnedthebasicconfigurationstyle,youwillbeabletoapplyitinmanyareas.Resources,middletierobjects,andwebcomponentsareallsetupusingthesamebeanconfigurationmechanism.Youcancombineyourentireconfigurationinonesinglebeandefinitionfileorsplititbyapplicationmodulesorlayers;thechoiceisuptoyouastheapplicationdeveloper.Thereisnoneedfordiverseconfigurationfilesinavarietyofformats,spreadoutacrosstheapplication.
SpringonJ2EE
AlthoughmanypartsofSpringcanbeusedinanykindofJavaenvironment,itisprimarilyaJ2EEapplicationframework.Forexample,thereareconvenienceclassesforlinkingJNDIresourcesintoabeanfactory,suchasJDBCDataSourcesandEJBs,andintegrationwithJTAfordistributedtransactionmanagement.Inmostcases,applicationobjectsdonotneedtoworkwithJ2EEAPIsdirectly,improvingreusabilityandmeaningthatthereisnoneedtowriteverbose,hard—to—test,JNDIlookups.
ThusSpringallowsapplicationcodetoseamlesslyintegrateintoaJ2EEenvironmentwithoutbeingunnecessarilytiedtoit.YoucanbuilduponJ2EEserviceswhereitmakessenseforyourapplication,andchooselighter-weightsolutionsiftherearenocomplexrequirements.Forexample,youneedtouseJTAastransactionstrategyonlyifyoufacedistributedtransactionrequireme
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 毕业论文外文翻译-Spring 框架简介 毕业论文 外文 翻译 Spring 框架 简介