{
environment.setProperties(properties);
}
packagesToSearch = ArrayUtils.add(packagesToSearch, getClass().getPackage().getName());
final ServiceProvider serviceProvider = new ServiceProvider(packagesToSearch);
final List<PropertyReader> propertyReaders = Lists.newArrayList(serviceProvider.find(FlipProperty.class,
PropertyReader.class));
Collections.sort(propertyReaders, new FlipPropertiesPriorityComparator());
environment.setPropertyReaders(propertyReaders);
final List<Object> contextProviders = Lists.newArrayList(serviceProvider.find(FlipContext.class));
Collections.sort(contextProviders, new FlipContextsPriorityComparator());
environment.setContextProviders(contextProviders);
return environment;
}