Video: Dab tsi yog Qhov Chaw Tso Khoom Hauv Caij Nplooj Ntoos Hlav?
2024 Tus sau: Lynn Donovan | [email protected]. Kawg hloov kho: 2023-12-15 23:47
Caij nplooj ntoos hlav ntsiab lus: vaj tse - qhov chaw . Cov ntsiab lus: vaj tse - qhov chaw tag yog siv rau externalize khoom nyob rau hauv ib daim ntawv cais. Nws cia li configures PropertyPlaceholderConfigurer , uas hloov cov ${} placeholder, uas tau daws tawm tsam ib qho kev teev tseg khoom file (as a Caij nplooj ntoos hlav qhov chaw muab kev pab).
Tom qab ntawd, ib tug kuj yuav nug, dab tsi yog cov ntaub ntawv hauv lub caij nplooj ntoos hlav?
cov ntaub ntawv tsis muaj dab tsi ntau tshaj qhov yooj yim-tus nqi cia rau kev teeb tsa khoom . Koj tuaj yeem ntim cov kev teeb tsa ntaub ntawv hauv koj lub thawv ntawv thov los yog muab tso rau ntaub ntawv nyob rau hauv lub filesystem ntawm lub sij hawm ib puag ncig thiab thauj nws rau Caij nplooj ntoos hlav Boot pib.
Tsis tas li ntawd, nyeem cov ntaub ntawv li cas thaum caij nplooj ntoos hlav? Nyeem cov ntaub ntawv khoom hauv Caij Nplooj Hlav siv XML configuration Tom qab ntawd koj tuaj yeem siv ${ vaj tse key} placeholder hauv kev txhais. Txhawm rau daws cov chaw tso cai no koj yuav tsum sau npe rau PropertySourcesPlaceholderConfigurer. Qhov no tshwm sim tau txais thaum siv <context: vaj tse -placeholder> hauv XML.
Ntawm no, kev siv PropertyPlaceholderConfigurer nyob rau lub caij nplooj ntoo hlav yog dab tsi?
Cov PropertyPlaceholderConfigurer yog ib qho cuab yeej cuab tam configurer uas daws qhov chaw nyob hauv cov khoom vaj tse taum ntawm cov ntsiab lus txhais. Nws rub cov txiaj ntsig los ntawm cov ntaub ntawv cov khoom rau hauv cov ntsiab lus taum.
Dab tsi yog ib puag ncig abstraction nyob rau lub caij nplooj ntoos hlav?
Cov Environment abstraction nyob rau lub caij nplooj ntoos hlav sawv cev rau ib puag ncig uas tam sim no daim ntawv thov yog khiav. Nyob rau lub sijhawm no, nws zoo li koom ua ke txoj hauv kev nkag mus rau cov cuab yeej hauv ntau yam khoom ntiag tug, xws li cov ntaub ntawv khoom, JVM cov khoom siv, cov kab ke. ib puag ncig variables, thiab servlet ntsiab lus parameters.
Pom zoo:
Tam sim no version ntawm caij nplooj ntoos hlav yog dab tsi?
Lub Caij Nplooj Ntoos Hlav 4.3 tau tshaj tawm rau 10 Lub Rau Hli 2016 thiab yuav txhawb nqa mus txog rau xyoo 2020. Nws 'yuav yog tiam kawg nyob rau hauv lub caij nplooj ntoos hlav 4 dav dav (Java 6+, Servlet 2.5+), []'. Caij nplooj ntoos hlav 5 tau tshaj tawm los ua raws li Reactive Stream tau tshaj Reactor Core
Dab tsi yog qhov peev txheej thaum caij nplooj ntoos hlav?
Cov peev txheej yog qhov cuam tshuam hauv Spring los sawv cev rau cov peev txheej sab nraud. Caij nplooj ntoos hlav muab ob peb qhov kev siv rau qhov Resource interface. Txoj kev getResource() ntawm ResourceLoader txiav txim siab qhov kev siv peev txheej los siv. Qhov no yog txiav txim los ntawm txoj kev peev txheej. Cov cai ntawm Resource interface yog qhov no
Dab tsi yog siv ntawm @autowired hauv caij nplooj ntoos hlav?
Autowiring nyob rau lub caij nplooj ntoos hlav. Autowiring feature ntawm lub caij nplooj ntoos hlav moj khaum enables koj mus txhaj cov khoom dependency implicitly. Nws sab hauv siv setter lossis constructor txhaj. Autowiring tsis tuaj yeem siv los txhaj qhov tseem ceeb thiab txoj hlua. Nws ua haujlwm nrog kev siv nkaus xwb
@RequestParam yog dab tsi hauv khau raj caij nplooj ntoos hlav?
Software Hom: Daim ntawv thov txheej txheem
Dab tsi yog qhov txawv ntawm byType thiab byName hauv caij nplooj ntoos hlav?
Qhov sib txawv ntawm byType thiab byName autowiring yog raws li hauv qab no: Autowire byType yuav tshawb nrhiav taum hauv cov ntaub ntawv teeb tsa, uas nws tus id phim nrog cov cuab yeej cuab tam yuav raug xaim whereas autowire byName yuav tshawb rau taum uas nws tus id yog txuam nrog cov cuab yeej lub npe. siv kab