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.
ремонт бетонных конструкций гарантия remont-betona-1.ru .
https://81mreg.zombeek.cz
melbet ставки приложение melbet ставки приложение
1xbet mobil giri? 1xbet-53.com .
https://rentry.co/uxgeg37h
усиление грунта цена за м3 usilenie-gruntov-1.ru .
https://telegra.ph/Multiki-nu-pogodi-smotret-besplatno-02-07
1win mines pe mobil https://1win5808.help/
https://snippet.host/qthtae
мостбет сабти ном мостбет сабти ном
mostbet ҳисоб бо TJS mostbet95163.help
1win giriş linki https://www.1win82430.help
https://bxuqwh.zombeek.cz
https://rentry.co/kwgre8ac
https://telegra.ph/Kartopriemnik-01-04
https://rentry.co/hrdceyvp
транс под попперсом
jolt попперс
https://telegra.ph/Kak-upotreblyat-poppers-12-14
sweet bonanza додаток скачати sweet bonanza додаток скачати
https://3qg5lr.zombeek.cz
попперс для мужчин и женщин
https://0bx8dz.zombeek.cz
mostbet crash на деньги http://www.mostbet78063.help
https://site934477954.fo.team
https://site292035775.fo.team
ремонт бетонных конструкций технология ремонт бетонных конструкций технология .
https://telegra.ph/Fejskultura-11-11
игра aviator melbet https://www.melbet41682.help
вызывает ли попперс зависимость
1xbet com giri? 1xbet-54.com .
попперс употребление видео
https://telegra.ph/Multfilm-ivan-carevich-i-seryj-volk-4-11-15
попперс Томск
https://kqevxm.zombeek.cz
купить попперс Новокузнецк
1win retragere instant http://www.1win5808.help
https://paiza.io/projects/uH58xs9Zqz9QT9NEhUjkUQ
https://g1fmsp.zombeek.cz
порно на занятии йогой порно на занятии йогой .
masturbate попперс
купить попперс россия
отделка подвала gidroizolyacziya-podvalov.ru .
https://telegra.ph/Stih-pro-druzej-03-06
https://www.majalahsains.com/careers/employer/activationgdv40/
https://site77150512.fo.team
купить попперс Смоленск
https://site45208318.fo.team
Всем привет! Рзучал тему развития бизнеса РІ интернете Рё наткнулся РЅР° полезную статью. Там РїСЂРѕ комплексное продвижение сайтов: SEO, контекст, контент-маркетинг, соцсети, аналитику. Есть блок РїСЂРѕ ошибки Рё РїСЂРѕ современные тренды — персонализация, РР, омниканальность. Рекомендую Рє прочтению: https://wikicom.ru/2025/12/jeffektivnoe-prodvizhenie-sajtov-i-razvitie-biznesa-v-internete/
попперс Курган