ContextClosedEvent yog dab tsi?
ContextClosedEvent yog dab tsi?

Video: ContextClosedEvent yog dab tsi?

Video: ContextClosedEvent yog dab tsi?
Video: Event handling in spring [ContextRefreshedEvent and ContextClosedEvent] | Spring event handling 2024, Tej zaum
Anonim

ContextClosedEvent . Qhov no xwm txheej tau luam tawm thaum ApplicationContext raug kaw siv txoj kev kaw () ntawm ConfigurableApplicationContext interface. Lub ntsiab lus kaw mus txog qhov kawg ntawm lub neej; nws tsis tuaj yeem rov kho dua lossis rov pib dua.

Tib neeg kuj nug, dab tsi yog lub caij nplooj ntoos hlav tuav?

Caij nplooj ntoos hlav Event Handling , Qhov tseem ceeb ntawm Caij nplooj ntoos hlav yog ApplicationContext, Cov ntsiab lus ntawm Daim Ntawv Thov muab ib txoj hauv kev los txiav txim siab cov lus tam sim thiab muab ib txoj hauv kev tsis tshwj xeeb los thauj cov ntaub ntawv cov cuab tam thiab nws tuaj yeem faib xwm txheej rau taum uas tau sau npe ua tus mloog. Cov xwm txheej ntawm Caij nplooj ntoos hlav raws li nram no.

Tsis tas li ntawd, ApplicationListener nyob rau lub caij nplooj ntoo hlav yog dab tsi? Spring ApplicationListener . Caij nplooj ntoos hlav muaj kev siv ntawm ib ApplicationListener uas tso cai Caij nplooj ntoos hlav tej yaam num los tua cov xwm txheej muaj txiaj ntsig rau cov neeg nyiam (Observer Pattern, saib Caij nplooj ntoos hlav Doc). Txhawm rau nkag mus rau cov xwm txheej no txhua yam koj xav tau yog taum hauv Daim Ntawv Thov Cov Ntsiab Lus uas siv ApplicationListener.

Ib yam li ntawd, ConfigurableApplicationContext yog dab tsi?

ConfigurableApplicationContext yog ib qho interface uas txuas ntxiv ApplicationContext, Lifecycle interfaces. SPI interface yuav tsum tau siv los ntawm feem ntau yog tias tsis yog txhua daim ntawv thov cov ntsiab lus.

Dab tsi yog qhov xwm txheej hauv cov ntsiab lus ntawm Java?

Ib xwm txheej hauv Java yog ib yam khoom uas yog tsim thaum ib yam dab tsi hloov nyob rau hauv ib tug graphical user interface. Yog tias tus neeg siv nyem rau ntawm lub pob, nyem rau ntawm lub npov combo, lossis ntaus cov cim rau hauv cov ntawv nyeem, thiab lwm yam, ces ib qho xwm txheej triggers, tsim qhov cuam tshuam xwm txheej khoom.

Pom zoo: