Inheriting class annotations
问题 Is there a way to make classes inherit annotations from a superclass ? e.g. @ApplicationException(rollback=true) public abstract class AbstractBeanActionException extends Exception { /* method body is simply calls to super() */ } public class OrderBeanException extends AbstractBeanActionException { /* does this class have to be annotated as well ? */ } 回答1: Class annotations can not be inherited by subclasses. What you can do is "force" the subclass to use the annotation at compile time: