SpringBasedContainer extends AbstractComponentRegistry implements Container { public <T> boolean canProvide(Class<T> type) { return BeanFactoryUtils.beanNamesForTypeIncludingAncestors(parentContext, type).length > 0; } SpringBasedContainer(ConfigurableWebApplicationContext parentContext); void register(Class<?> requiredType, Class<?> componentType); T instanceFor(Class<T> type); boolean canProvide(Class<T> type); void start(ServletContext context); void stop();  }
@Test public void shouldProvideOnlyIfBeanIsRegistered() { assertTrue(container.canProvide(DummyComponent.class)); assertFalse(container.canProvide(NotRegisterd.class)); }
@Test public void shouldNotProvidePrimitiveValues() { assertFalse(container.canProvide(Long.class)); assertFalse(container.canProvide(long.class)); assertFalse(container.canProvide(long[].class)); assertFalse(container.canProvide(Long[].class)); }