public void initialize ( ComponentManager manager , ClassLoader classLoader ) { try { // Find all declared components by retrieving the list defined in COMPONENT_LIST. List < ComponentDeclaration > componentDeclarations = getDeclaredComponents ( classLoader , COMPONENT_LIST ) ; // Find all the Component overrides and adds them to the bottom of the list as component declarations with // the highest priority of 0. This is purely for backward compatibility since the override files is now // deprecated. List < ComponentDeclaration > componentOverrideDeclarations = getDeclaredComponents ( classLoader , COMPONENT_OVERRIDE_LIST ) ; for ( ComponentDeclaration componentOverrideDeclaration : componentOverrideDeclarations ) { // Since the old way to declare an override was to define it in both a component.txt and a // component-overrides.txt file we first need to remove the override component declaration stored in // componentDeclarations. componentDeclarations . remove ( componentOverrideDeclaration ) ; // Add it to the end of the list with the highest priority. componentDeclarations . add ( new ComponentDeclaration ( componentOverrideDeclaration . getImplementationClassName ( ) , 0 ) ) ; } initialize ( manager , classLoader , componentDeclarations ) ; } catch ( Exception e ) { // Make sure we make the calling code fail in order to fail fast and prevent the application to start // if something is amiss. throw new RuntimeException ( "Failed to get the list of components to load" , e ) ; } }
Loads all components defined using annotations .