Video: Lub ntsiab lus configuration nyob rau lub caij nplooj ntoos hlav yog dab tsi?
2024 Tus sau: Lynn Donovan | [email protected]. Kawg hloov kho: 2023-12-15 23:47
Dab tsi yog a Caij nplooj ntoos hlav ntsiab lus ? Caij nplooj ntoos hlav cov ntsiab lus tseem hu ua Caij nplooj ntoos hlav IoC ntim, uas yog lub luag haujlwm rau instantiating, kev teeb tsa , thiab sib sau taum los ntawm kev nyeem ntawv kev teeb tsa metadata los ntawm XML, Java annotations, thiab/los yog Java code nyob rau hauv lub kev teeb tsa cov ntaub ntawv.
Hauv qhov no, dab tsi yog daim ntawv thov cov ntsiab lus hauv lub caij nplooj ntoo hlav?
Cov ApplicationContext yog lub hauv paus interface hauv ib Daim ntawv thov caij nplooj ntoos hlav uas yog siv los muab cov ntaub ntawv configuration rau lub daim ntawv thov . Nws siv BeanFactory interface.
Tom qab ntawd, lo lus nug yog, @ContextConfiguration yog dab tsi nyob rau lub caij nplooj ntoo hlav? @ ContextConfiguration txhais cov chav kawm-theem metadata uas yog siv los txiav txim siab yuav ua li cas thauj khoom thiab teeb tsa ApplicationContext rau kev sib koom ua ke.
Hais txog qhov no, cov ntsiab lus XML nyob rau lub caij nplooj ntoos hlav yog dab tsi?
Caij nplooj ntoos hlav cia koj txhais ntau yam cov ntsiab lus nyob rau hauv niam txiv-tus me nyuam hierarchy. ApplicationContext. xml txhais cov taum rau "hauv paus webapp ntsiab lus ", ie ntsiab lus txuam nrog lub webapp. Cov caij nplooj ntoos hlav -servlet. xml (los yog lwm yam uas koj hu nws) txhais taum rau ib lub servlet lub app ntsiab lus.
Spring application context file nyob qhov twg?
Lub hauv paus rau lub ntsiab lus pob yog cov ApplicationContext interface, nyob rau hauv lub org. springframework.
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
Kev siv @value annotation nyob rau lub caij nplooj ntoos hlav yog dab tsi?
Spring @PropertySource annotations yog tsuas yog siv los nyeem los ntawm cov ntaub ntawv khoom siv Spring's Environment interface. Cov lus piav qhia no yog nyob rau hauv kev xyaum, muab tso rau ntawm @Configuration chav kawm. Caij nplooj ntoos hlav @Value annotation tuaj yeem siv los qhia cov lus qhia ntawm daim teb lossis txoj hauv kev. Cov ntaub ntawv siv feem ntau yog qhia cov cuab yeej los ntawm a