@ PreDestroy public void removeGeneratedClasses ( ) { ClassPool pool = ClassPool . getDefault ( ) ; for ( Class < ? > clazz : interfaces . values ( ) ) { CtClass ctClass = pool . getOrNull ( clazz . getName ( ) ) ; if ( ctClass != null ) { ctClass . detach ( ) ; logger . debug ( "class {} is detached" , clazz . getName ( ) ) ; } } }
Remove generated classes when application stops due reload context issues .