Commit bd6f444
committed
Fix Netty interception when launched in Docker
Within static fields, it was not possible to access project dependencies
at runtime. Specifically, when launching the spring petclinic
microservices demo, the API gateway that uses HttpClient crashed because
reactor.netty.transport.ProxyProvider wasn't available when evaluating
the static field.
I'm fairly sure this is due to the app being launched with
org.springframework.boot.loader.JarLauncher, which reconfigures the
classpath during startup. To work around this, we defer loading these
inaccessible types until the intercepted HttpClient constructor. That
probably creates a very minor performance hit, but nothing significant.
If this does become significant in future, we could probably preserve
the fields, and make constructor initialization a one-off, but it's more
complicated and risky, so let's not bother for now. Only matters if
you're creating very very large numbers of HttpClients in a hot loop,
which seems unlikely.1 parent 400d973 commit bd6f444
File tree
1 file changed
+27
-30
lines changed- src/main/java/tech/httptoolkit/javaagent/advice/reactornetty
1 file changed
+27
-30
lines changedsrc/main/java/tech/httptoolkit/javaagent/advice/reactornetty/ReactorNettyResetAllConfigAdvice.java
Lines changed: 27 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
28 | 19 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
34 | 28 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
| 45 | + | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
| |||
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 55 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
| |||
0 commit comments