private static ConversionService getConversionService() {
    if (conversionService == null) {
      if (ApplicationContextProvider.getApplicationContext() == null) {
        // We are not in a Spring managed environment
        conversionService = new DefaultConversionService();
        ((DefaultConversionService) conversionService).addConverter(new DateToStringConverter());
        ((DefaultConversionService) conversionService).addConverter(new StringToDateConverter());
      } else {
        conversionService =
            ApplicationContextProvider.getApplicationContext().getBean(ConversionService.class);
      }
    }

    return conversionService;
  }
Exemple #2
0
 private String getMolgenisSetting(String key, String defaultValue) {
   try {
     MolgenisSettings molgenisSettings =
         ApplicationContextProvider.getApplicationContext().getBean(MolgenisSettings.class);
     return molgenisSettings.getProperty(key, defaultValue);
   } catch (NoSuchBeanDefinitionException e) {
     logger.warn(e);
     return defaultValue;
   }
 }
 /**
  * Can't be autowired due to circular dependency resolving
  *
  * @return
  */
 private MolgenisUi getMolgenisUi() {
   return ApplicationContextProvider.getApplicationContext().getBean(MolgenisUi.class);
 }
 /**
  * Can't be autowired due to circular dependency resolving
  *
  * @return
  */
 private MolgenisPermissionService getMolgenisPermissionService() {
   return ApplicationContextProvider.getApplicationContext()
       .getBean(MolgenisPermissionService.class);
 }