0

In a Spring application we have several warnings like this:

o.s.aop.framework.CglibAopProxy - Unable to proxy interface-implementing method [...] 
because it is marked as final: 
Consider using interface-based JDK proxies instead!

This question and its answers describe well the whole issue:

Using CGLIB has a limitation that methods marked as final in target class can’t be advised as final methods can’t be overridden (CGLIB creates a subclass of target class at runtime) but this limitation disappears in case of using JDK dynamic proxies.

There are situations where you simply need to use it, such as here.

The solutions I found say more or less Don't worry, it is only a warning, you may decrease the log level if you don't like to see it.

My question is more specific: Is it possible to suppress the warning for a specific class only? We do not want to suppress all the warnings, just the ones where we know that what we are doing is on purpose.

Version:

  • Spring Boot Starter: 2.0.0.M3
  • Spring: 5.0.0.RC3
Honza Zidek
  • 9,204
  • 4
  • 72
  • 118
  • No there isn't unless you write your own logging appender which has that knowledge... Otherwise you could only suppress the logging for the `o.s.aop.framework.CglibAopProxy` by setting the level for that logger to `ERROR`. – M. Deinum Oct 05 '17 at 12:02
  • @M.Deinum if you are sure with your comment could you please turn it into an answer with a small hint as for how to write my own login appender "which has that knowledge" - did you mean which textually parses what is being logged and filters out based on a regular expression or so? – Honza Zidek Apr 02 '19 at 06:29
  • @M.Deinum Do you wish to turn your comment into an answer? :) It would make sense to have the question answered... – Honza Zidek Oct 11 '21 at 08:13

0 Answers0