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/Skachat-pesnyu-tumany-besplatno-11-25
купить сиалис Петрозаводск
https://paiza.io/projects/3BCAwEcgNYfH9U0zOXmzWQ
проститутки воронеж
Официальный сайт Vavada предоставляет стабильный доступ.
Разнообразные развлечения поддерживаются ведущими провайдерами.
После входа открываются бонусы и акции, что упрощает путь новичкам.
Техническая поддержка работает круглосуточно, обеспечивая спокойствие пользователей.
Актуальный вход всегда доступен по ссылке vavadaru-rus.org — сохраните, чтобы не потерять доступ.
Держите баланс под контролем, чтобы процесс приносил удовольствие.
можно ли употреблять виагру
https://telegra.ph/Nizhegorodskij-teatr-dramy-oficialnyj-sajt-11-21
https://telegra.ph/Tubdispanser-primorskogo-rajona-spb-11-21
где можно купить настоящие попперсы в москве
попперс в саратове купить
попперс скачать
https://csncbb.zombeek.cz
https://ra0nyj.zombeek.cz
https://site108959692.fo.team
https://telegra.ph/Audi-tula-oficialnyj-diler-11-23
https://telegra.ph/The-xx-i-dare-you-perevod-11-19
https://rentry.co/wgwsf5pk
https://site514431103.fo.team
попперс amyl описание
https://rentry.co/bdzfy6gy
д ж е н е р и к
купить виагру в аптеке сочи
и ж е в с к
гипноз для сисси девочек порно попперс
https://telegra.ph/Ooo-strojsoyuz-11-09
динамико сиалис
https://www.bitsdujour.com/profiles/Zio7xT
https://paiza.io/projects/soa09vZwZvezOelInTyhRA
https://www.bitsdujour.com/profiles/bF92Qq
купить попперс Ачинск
https://telegra.ph/Saj7-info-02-04
транс гей
https://site810605789.fo.team
https://telegra.ph/Pozdravleniya-s-dnem-rozhdeniya-dlya-zhenshchiny-11-09
Букеты в ящике из живых цветов Поддержание свежести композиций в помещениях регулярно
https://telegra.ph/Lihoradka-mifologiya-01-12
Москва заказать букет цветов Всегда в наличии популярные сорта живых цветов
купить сиалис софт Смоленск
https://telegra.ph/Poppers-EHlektrostal-12-06
Д о м о д е д о в о
https://snippet.host/kgxtsy
hard ware original попперс описание
beste wettanbieter online
Here is my blog – handicap wette erklärung (Gratis-wetten.com)
https://telegra.ph/Nautilus-slushat-onlajn-01-31
https://site963781634.fo.team
wettbüro innsbruck
My site; basketball Pro b wetten
https://paiza.io/projects/W_FdLHnHdbOwoes_4xsCmw
как правильно нюхать попперс
https://telegra.ph/Uvelichen-limfouzel-pod-myshkoj-s-odnoj-storony-u-zhenshchin-02-17
в каких странах запрещен попперс