Search
Duplicate
๐ŸŒฑ

(Transactional)EventListener

EventListener

publishEvent() ์—์„œ ๋™์ž‘ํ•œ๋‹ค.

TransactionalEventListener

publishEvent() ์—์„œ ๋™์ž‘ํ•˜๋Š”๋ฐ, ์ด ๋•Œ ๋‹จ์ˆœํžˆTransactionalApplicationListenerSynchronization ์— ๋“ฑ๋กํ•œ๋‹ค.
TransactionInterceptor ์—์„œ commit ํ›„์— afterCompletion ์—์„œ ๋™์ž‘ํ•œ๋‹ค( TAS$invokeWithinTransaction ์˜commitTransactionAfterReturning
๋‘˜์˜ ์ฐจ์ด:
EventListener ๋Š” ApplicationListenerMethodAdapter
TransactionalEventListener ๋Š” TransactionalApplicationListenerMethodAdapter
์ด๋‹ค.

TransactionalEventListener

โ€ข
publishEvent ์—์„œ ๋“ฑ๋ก๋œ๋‹ค.

EventListener

โ€ข
application ๊ตฌ๋™์‹œ abstractApplicationContext ์—์„œ ๋“ฑ๋ก๋œ๋‹ค.
listeners ๋ฅผ ๊ฐ€์ ธ์˜ฌ ๋•Œ ๋ชจ๋“  listener ๋ฅผ ์ˆœํšŒ๋Œ๋ฉด์„œ event type ๊ณผ ๋งž๋Š” listener ๋“ค๋งŒ ๊ฐ€์ ธ์˜จ๋‹ค.