वसंत 4 में दो नए एनोटेशन @Condition
और @ConfigurationConditon
को नियंत्रित करने के लिए वसंत अनुप्रयोग संदर्भ में एक बीन जोड़ा गया है या नहीं। JavaDoc @ConfigurationCondition
के उपयोग के मामलों को समझने के लिए पर्याप्त संदर्भ/बड़ी तस्वीर प्रदान नहीं करता है।वसंत @ कॉन्फ़िगरेशन कंडीशन बनाम @ कंडिशन का उपयोग कब करें?
@ConfigurationCondition
का उपयोग @Condition
बनाम किया जाना चाहिए?
public interface ConfigurationCondition extends Condition {
/**
* Returns the {@link ConfigurationPhase} in which the condition should be evaluated.
*/
ConfigurationPhase getConfigurationPhase();
/**
* The various configuration phases where the condition could be evaluated.
*/
public static enum ConfigurationPhase {
/**
* The {@link Condition} should be evaluated as a {@code @Configuration} class is
* being parsed.
*
* <p>If the condition does not match at this point the {@code @Configuration}
* class will not be added.
*/
PARSE_CONFIGURATION,
/**
* The {@link Condition} should be evaluated when adding a regular (non
* {@code @Configuration}) bean. The condition will not prevent
* {@code @Configuration} classes from being added.
*
* <p>At the time that the condition is evaluated all {@code @Configuration}s
* will have been parsed.
*/
REGISTER_BEAN
}
}
क्या आप दो अलग-अलग चरणों के अर्थ के बारे में अधिक जानकारी दे सकते हैं। क्या ये चरण बीन प्रारंभिक जीवन चक्र में चरणों से अलग हैं जहां विभिन्न पोस्ट प्रोसेसर निष्पादित होते हैं? – ams
मेरा जवाब अपडेट किया गया। –