As you know, the annotation driven programming is more and more incorporated in the majority of frameworks that we are using nowadays (i.e. Spring, Lombok etc).
Besides, we need sometimes to create our custom annotation. (i.g. Logging enter/exit traces for all public methods of a given class using an aspect - @LogAroundMethods
)
Hence, a given class can hold plenty of annotations.
@LogAroundMethod // My custom annotation
@Slf4j // Lombok annotation
@Component // Spring annotation
public class ClientNotificationProxy {
//Code
}
@LogAroundMethod // My custom annotation
@Configuration // Spring annotation
@ConditionalOnClass(NotificationSender.class) // Spring annotation
@EnableConfigurationProperties(MessagingProperties.class) // Spring annotation
@Import({ MongoConfiguration.class, SpringRetryConfiguration.class }) // Spring annotation
public class StarterClientAutoConfiguration {
// Code
}
- What's the recommended order of annotations ?
- Is there any impact or benefit from a specific order ?