Exactly!
One more idea is to leverage the instrumentation on JVM to enable runtime enhancement. More details on https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/package-summary.html