Answer the question
In order to leave comments, you need to log in
Are annotations inherited in java?
There are two classes
First:
@JsonIgnoreProperties(ignoreUnknown = true)
public abstract class Parent implements Serializable
public class Child extends Parent
Answer the question
In order to leave comments, you need to log in
By default it will not be inherited. However, if the annotation is marked as Inherited , then it is inherited. Since most often annotations are not inherited, helpers can be used to search for annotations on a class and its parents, for example, the Spring Core library contains findAnnotations methods to search for specific annotations on a class (or its parents) or a method (or parent methods that are overridden by this method ).
Here is a good example explaining how Inherited works: tyrts .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question