Skip to content

Instantly share code, notes, and snippets.

@ksundong
Created August 16, 2020 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksundong/226ad6a20a56e1355190b3ef3596bd86 to your computer and use it in GitHub Desktop.
Save ksundong/226ad6a20a56e1355190b3ef3596bd86 to your computer and use it in GitHub Desktop.
Get Bean을 통해 배우는 제네릭
@Override
public <T> T getBean(Class<T> requiredType, @Nullable Object... args) throws BeansException {
Assert.notNull(requiredType, "Required type must not be null");
Object resolved = resolveBean(ResolvableType.forRawClass(requiredType), args, false);
if (resolved == null) {
throw new NoSuchBeanDefinitionException(requiredType);
}
return (T) resolved;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment