byte-buddy throws java.lang.ClassNotFoundException: javax.servlet.http.HttpServlet

断了今生、忘了曾经 提交于 2019-12-04 16:07:34

I assume that the servlet-family of types is not available to the class loader that Byte Buddy is using for resolving the advice. To overcome this, Byte Buddy offers a specific transformer that resolves the advice class for both the user's and the agent's class loader:

new AgentBuilder.Transformation.ForAdvice()
  .include(getClass().getClassLoader())
  .advice("your.pkg.ServletAdvice")

As for the element matchers, rather match the arguments' names then using the type constants.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!