Cov txheej txheem:
Video: Lub caij nplooj ntoos hlav LocalSessionFactoryBean yog dab tsi?
2024 Tus sau: Lynn Donovan | [email protected]. Kawg hloov kho: 2023-12-15 23:47
Caij nplooj ntoos hlav muab cov LocalSessionFactoryBean chav kawm ua lub Hoobkas rau SessionFactory khoom. Cov LocalSessionFactoryBean Cov khoom raug teeb tsa raws li taum hauv IoC thawv, nrog rau ib lub zos JDBC DataSource los yog sib koom DataSource los ntawm JNDI.
Tsis tas li ntawd, SessionFactory nyob rau lub caij nplooj ntoo hlav yog dab tsi?
SessionFactory yog ib qho interface. SessionFactory tuaj yeem tsim los ntawm kev muab cov khoom Configuration, uas yuav muaj tag nrho DB ntsig txog cov ntsiab lus rub tawm los ntawm hibernate. cfg ua. xml file los yog hibernate. Cov SessionFactory yog cov khoom siv xov zoo thiab siv los ntawm tag nrho cov xov ntawm ib daim ntawv thov.
Ib sab saum toj no, kev siv HibernateTransactionManager yog dab tsi? Cov daim ntawv thov uas siv ib zaug hibernate kev sib kho Hoobkas rau kev lag luam database, muaj kev xaiv zoo rau siv HibernateTransactionManager . HibernateTransactionManager tuaj yeem ua haujlwm nrog dawb JDBC ib yam nkaus. HibernateTransactionManager tso cai rau tej hloov tshiab thiab bulk ntxig thiab xyuas kom meej cov ntaub ntawv.
Hais txog qhov no, Spring ORM yog dab tsi?
Caij nplooj ntoos hlav ORM DAO Class @Component yog Caij nplooj ntoos hlav annotation uas qhia cov Caij nplooj ntoos hlav thawv uas peb tuaj yeem siv chav kawm no los ntawm Caij nplooj ntoos hlav IoC (Dependency Txhaj). Peb siv JPA @PersistenceContext annotation uas qhia tias muaj kev vam khom rau qhov EntityManager.
Yuav ua li cas koj configure hibernate nyob rau hauv caij nplooj ntoos hlav?
Cia peb pom dab tsi yog cov kauj ruam yooj yim rau hibernate thiab caij nplooj ntoos hlav kev koom ua ke:
- tsim cov lus hauv database Nws yog xaiv tau.
- tsim applicationContext. xml cov ntaub ntawv Nws muaj cov ntaub ntawv ntawm DataSource, SessionFactory thiab lwm yam.
- tsim tus neeg ua haujlwm.
- tsim cov neeg ua haujlwm.
- tsim EmployeeDao.
- tsim InsertTest.
Pom zoo:
Dao chav kawm nyob rau lub caij nplooj ntoos hlav yog dab tsi?
Nws yog tus qauv tsim nyob rau hauv uas cov ntaub ntawv nkag mus siv khoom (DAO) yog ib yam khoom uas muab qhov kev paub daws teeb meem rau qee hom database lossis lwm yam kev ua haujlwm ruaj khov. Lub caij nplooj ntoos hlav cov ntaub ntawv nkag mus rau lub moj khaum yog muab los koom ua ke nrog cov txheej txheem sib txawv xws li JDBC, Hibernate, JPA, iBatis thiab lwm yam
@ResponseBody annotation nyob rau lub caij nplooj ntoos hlav yog dab tsi?
Cov lus siv: Java, JSON
Cron kev qhia yog dab tsi nyob rau lub caij nplooj ntoos hlav?
Ib qho Cron qhia muaj rau qhov ua ntu zus - thib ob, feeb, teev, hnub ntawm lub hli, hli, hnub (s) ntawm lub lim tiam.thiab tau tshaj tawm raws li hauv qab no @Scheduled(cron = '* * * * **')
Log4j nyob rau lub caij nplooj ntoos hlav yog dab tsi?
Log4j yog qhov nrov thiab siv dav hauv kev nkag mus rau Java txoj kev loj hlob. Nws yooj yim zoo nkauj los teeb thiab siv Log4j mechanism hauv Spring Mvc daim ntawv thov. Nyob rau hauv no nyeem, kuv yuav qhia koj yuav ua li cas rau siv lub loging functionality nrog lub caij nplooj ntoos hlav Mvc moj khaum
Lub ntsiab lus configuration nyob rau lub caij nplooj ntoos hlav yog dab tsi?
Lub Caij Nplooj Ntoos Zeeg yog dab tsi? Caij nplooj ntoos hlav ntsiab lus tseem hu ua Spring IoC ntim, uas yog lub luag hauj lwm rau instantiating, configuring, thiab assembling taum los ntawm kev nyeem configuration metadata los ntawm XML, Java annotations, thiab / los yog Java code nyob rau hauv cov ntaub ntawv configuration