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.
https://telegra.ph/Poppers-gagarin-12-17
https://telegra.ph/Vyun-nad-vodoj-slushat-01-30
eurovision buchmacher
my page :: strategie bei sportwetten, https://msrajput.com/2025/10/07/beste-online-casinos-osterreich,
https://telegra.ph/Smotret-film-sverhestestvennoe-2-sezon-01-06
У л а н – У д э
купить оптом дженерики сиалис
super p-force купить
https://telegra.ph/Roman-kostomarov-i-oksana-domnina-deti-foto-02-05
https://nmcsgr.zombeek.cz
https://rentry.co/hnnab8qu
https://site542936313.fo.team
https://telegra.ph/Manga-obzhigayushchaya-nevinnaya-devushka-11-13
попперс Курск
https://teletype.link/ericssonkts406
https://4f2qli.zombeek.cz
https://telegra.ph/Ocharovanie-zhenstvennosti-helen-andelin-chitat-11-23
https://site944968182.fo.team
купить супер виагра Калининград
https://site847361365.fo.team
https://telegra.ph/Pesnya-davaj-nalivaj-12-09
игровые автоматы играть бесплатно и без регистрации Rise of Olympus Origins Rise of Olympus где боги активируют мощные функции. Зевс дарит множители до 20x Посейдон – перезапуски с гарантированными Wilds Аид – удаление низкооплачиваемых символов. Scatter в виде трезубца запускает фриспины с выбором бога-хранителя а фича Orb of Chaos усиливает комбо превращая обычные вращения в каскады разрушений.
форум виагра для мужчин
https://telegra.ph/Bukva-ty-panteleev-chitat-11-09
можно ли сочетать виагру и алкоголь
https://www.bitsdujour.com/profiles/iSqMBw
https://site823728983.fo.team
дал понюхать попперс
игровые автоматы играть бесплатно и без регистрации Rise of Olympus Origins Rise of Olympus Origins обещает стать захватывающим дополнением к портфолио Playn GO. Сохраняя лучшие черты оригинала и добавляя свежие элементы этот слот имеет все шансы повторить успех своего предшественника и вновь завоевать сердца игроков. Приготовьтесь к возвращению на Олимп где могущественные боги ждут чтобы одарить вас своими благословениями
euro wetten basketball nba (Mandy)
https://telegra.ph/Rasschitat-ves-po-rostu-11-19
купить софт набор Новочеркасск
https://telegra.ph/Psoriaz-u-detej-foto-11-19
https://telegra.ph/Prestizhnye-potrebnosti-01-06
кашель от попперсов
https://m5vbof.zombeek.cz
попперс Ханты-Мансийск
попперс тольятти
https://site50958018.fo.team
игровые автоматы играть Rise of Olympus Origins Rise of Olympus где боги активируют мощные функции. Зевс дарит множители до 20x Посейдон – перезапуски с гарантированными Wilds Аид – удаление низкооплачиваемых символов. Scatter в виде трезубца запускает фриспины с выбором бога-хранителя а фича Orb of Chaos усиливает комбо превращая обычные вращения в каскады разрушений.
über unter wetten erklärung (Hazel) quoten
препараты для продления эякуляции
попперс Нижний Тагил
https://www.bitsdujour.com/profiles/rqIuYt
sportwetten sichere strategie
Here is my page – sportwette ohne Oasis
https://site799438150.fo.team
https://telegra.ph/Kupit-poppers-Domodedovo-12-08
купить попперс Керчь
самовывоз попперсов
сколько раз можно вдыхать попперс
https://telegra.ph/Poppers-kolomna-01-06