public <T> T getBean(Class<T> tClass) throws BeansException {
Map<String, T> foundBeans = getBeansOfType(tClass);
final int numberOfBeans = foundBeans.size();
if (numberOfBeans == 0 || numberOfBeans > 1) {
//TODO: Find some better concrete exception
throw new BeansException(
format("Just one %s bean expected. Found %d.", tClass.getName(), numberOfBeans)) {};
}
return foundBeans.entrySet().iterator().next().getValue();
}