I did some badness today.
I wanted an integration test to check to see if my @Transactional method actually did rollback on an optimistic lock failure. It’s a pretty business critical method so I wanted to be sure that the whole @Transactional and @Version annotation voodoo actually works.
The approach I took was to inject, what I called a “slowRepository” into the object with the @Transactional method. The slowRepository is just a mockito mock of the object which “answers” (using “thenAnswer”) to the “findBy…” with some custom code.
The idea is that at some point during the @Transactional method the slowRepository is called and the “answer” code is invoked. In the test, the answer code follows along the lines of:
1. Grab the data it requires from the (not slow) repository (the repository the slowRepository is mocking)
2. Switch back the slowRepository for the not slow repository
3. Invoke the @Transactional method again on a separate thread
4. Sleep for a bit
5. Wake up and return the data from step 1
The @Transactional call on the separate thread completes and commits before slowRepository wakes up. When it does, slowRepository returns stale data and the @Transactional method then fails accordingly.
The problem I encountered was using the setters for my @Autowired dependencies on the bean with the @Transactional method. I needed to use the setters so that I could switch in and out the slowRepository, but couldn’t because Spring AOP proxies are implementations of an interface, not subclasses (by default – yes I realise you can get Spring to proxy the target class using CGLIB). I found this blog post which explains how to get at the target object behind a Spring proxy. I converted it to Scala:
…which is pretty ninja.
какой попперс самый продолжительный
Azino777
д а п о к с е т и н
https://telegra.ph/Mr-kredo-12-04
no deposit online pokies nz, uk no deposit minimum bet casino singapore (Sherlene) and is bingo gambling in canada, or party casino download united states
https://dcahex.zombeek.cz
melbet вывод элкарт https://melbet47086.help/
дженерик super p-force
https://paiza.io/projects/G6ObEI46tagdHU4Wo3Yr2w
wetten ohne einzahlung österreich
Feel free to visit my blog – solingen wettbüro
https://site944798046.fo.team
https://rentry.co/8i5dvx5s
esport wetten online wettanbieter deutschland (http://WWW.Spanishtrainers.com) verboten
bedeutung handicap Pferderennen Hannover wetten
купить виагра софт Черкесск
https://site471931275.fo.team
курсовая работа купить курсовая работа купить .
https://kbmvkt.zombeek.cz
https://teletype.link/potentiallykcq501
https://vbnjfx.zombeek.cz
сиалис отзывы врачей противопоказания
порно рассказ попперс
https://sg419j.zombeek.cz
wette schweiz frankreich
my web page – Wetten Dass Bagger Basketball
https://telegra.ph/Supernyan-1-smotret-v-horoshem-kachestve-hd-1080-besplatno-11-09
https://electroswingthing.com/profile/belongehf63/
https://telegra.ph/Kofein-benzoat-natriya-cena-11-18
https://paiza.io/projects/emKmT1aGA05QdOsTxnKayA
мега камшот с попперс винтаж гей порно
продвижение сайтов продвижение сайтов .
https://www.bitsdujour.com/profiles/KdKKbd
https://paiza.io/projects/Vb1OQ_Kmi87ShNBYKhdWrw
что дает попперс
оптимизация и продвижение сайтов москва оптимизация и продвижение сайтов москва .
https://paiza.io/projects/MIY0bVl5u-O051nsOyVcLQ
https://snippet.host/yemuzs
частный seo оптимизатор частный seo оптимизатор .
продвижение в google продвижение в google .
купить попперс Находка
https://rentry.co/i9xrp7d2
https://telegra.ph/Margarita-terehova-data-smerti-03-12
продление полового акта таблетки
https://y6uxdb.zombeek.cz
москва сиалис 20 мг
https://telegra.ph/Viagra-stoimost-v-apteki-01-06
https://w8tjt1.zombeek.cz
https://site509159006.fo.team
https://snippet.host/juceqr
https://site773483300.fo.team
https://site452578696.fo.team