Description
Inspired by how Spring Boot's auto configuration system works using its ConditionalOnXYZ annotations, it would be great to support some similar annotations for specifying when a plugin may be allowed to be loaded. For example, we could have annotations for requiring presence of a particular class (like JndiManager for JNDI-related plugins), requiring a PropertiesUtil setting is set (as in LOG4J2-3299), etc.
This will help transition 2.x to 3.x where a lot of optional functionality will be split into their own modules. For 2.x, the best option here would be to make certain features opt-in rather than automatic based on the classpath.