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.
Вывод из запоя на дому в Казани удобен когда близкий человек не готов ехать в клинику плохо переносит дорогу или находится в состоянии сильной слабости. Врач приезжает на дому сохраняет анонимность спокойно объясняет процесс и начинает лечение только после осмотра и согласия пациента. Вызов врача на дому особенно важен если муж отец брат мама или другой близкий уже не может перестать пить и нуждается в срочной помощи. Получить дополнительные сведения – нарколог вывод из запоя казань
I find it quite rare to stumble upon a post that maintains such a high level of quality and readability from top to bottom so I simply had to leave a comment to acknowledge the excellent work you did right here. 10 zoo porno
I like how this post keeps the ideas easy to understand and accessible while also maintaining a relaxed and interesting conversational style throughout. fuck zoo porno
звоните круглосуточно по телефону горячей линии клиники: наши специалисты готовы оказать необходимую помощь в решении проблемы алкогольной зависимости. Углубиться в тему – вывод из запоя сочи
tn sportsbook app
Also visit my web blog; singapore betting agent – Lucile,
top australian online pokies, casinos uk and how much top
online pokies and casinos united statesn coins, or play n go casino in germany berlin [Rufus] canada
casa de handicap asiatico en apuestas [Darin] sin minimo de ingreso
juegos de casinos con dinero real
Feel free to surf to my web site :: Edad para entrar al casino monticello
Barcelona Psg Apuestas campeon liga bbva
improve your horse racing betting odds
Here is my homepage https://horse-betting.com/
Наркологическая помощь на дому особенно важна при алкогольной интоксикации длительном запое сильной слабости тревоге рвоте нарушении сна высоком давлении треморе спутанности поведения и риске осложнений. Врач нарколог приезжает по адресу проводит диагностику уточняет длительность употребления алкоголя наличие хронического алкоголизма опыт лечения противопоказаний заболеваний сердца печени нервной системы и других органов. После этого специалист выбирает безопасную схему терапии. Узнать больше – нарколог на дом вывод
В Балашихе выездной формат удобен для семьи если близкого нельзя быстро доставить в клинику или состояние пациента ухудшается на фоне длительного запоя. Дом становится местом первичной стабилизации когда врач видит что капельница вывод из запоя консультация снятие интоксикации и дальнейшие рекомендации могут быть проведены безопасно. Если состояние тяжелое нарколог объясняет почему нужна госпитализация стационар дополнительные обследования и круглосуточный медицинский контроль. Выяснить больше – vyzov-narkologa-na-dom-kruglosutochno-nedorogo
aintree festival betting
Review my site; Horse racing bet strategy
casinos para descargar
my webpage … casino chileno Online
bonos casino barcelona (https://Podlahytrefil.cz/2026/05/Tragaperras-gratis-con-bonus-espana/) a barcelone
Это один из лучших сайтов по дорожным
работам.
на ресурсе