Class SpringContextUtil


  • public class SpringContextUtil
    extends Object
    Methods to create Spring contexts for Gemma manually. This is meant to be used by CLIs only.
    Author:
    pavlidis
    • Constructor Detail

      • SpringContextUtil

        public SpringContextUtil()
    • Method Detail

      • getApplicationContext

        public static ApplicationContext getApplicationContext​(String[] activeProfiles,
                                                               String... additionalConfigurationLocations)
                                                        throws BeansException
        Obtain an application context for Gemma.
        Parameters:
        activeProfiles - list of active profiles, for testing use EnvironmentProfiles.TEST
        additionalConfigurationLocations - a list of additional configuration location to load beans from
        Returns:
        a fully initialized ApplicationContext
        Throws:
        BeansException - if the creation of the context fails
      • prepareContext

        public static void prepareContext​(ApplicationContext context)
        Prepare a given context for prime time.

        Perform the following steps:

        • activate the dev profile as a fallback if no profile are active
        • verify that exactly one environment profile is active (see EnvironmentProfiles)
        • log an informative message with the context version and active profiles