Skip to content
Advertisement

How I can turn on and off BlockHound check

I have some App with WebFlux and i want to use BlockHound, but i need to have a possible turn on and off it through parameter in application.properties or through spring profiling or somthing else. Also I want to override action, when the lock operation is caught so that not throw error but log warning. And firstly, i did through parameter in application.properties:

JavaScript

And my BlockHoundSwitch:

JavaScript

It works for me but in my opinion this solution quite difficult and a little unpredictable. Next i tried resolve this task through profiling:

JavaScript

And it works too. Well, I have a few questions:

  1. Which way is better, why and maybe there is another solution?
  2. I need to localize and log, where block operation happened. How can I get class name and method, where it`s happened?

Advertisement

Answer

I resolve it. Maybe someone it will be useful. I did it through profiling and my code bellow:

JavaScript

where application.package – main package of my project, which i`m finding in stacktrace.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement