private ApplicationContext applicationContext;
@Override
public Object invoke(MethodInvocation arg0) throws Throwable {
PrototypeGenerator generator = arg0.getMethod().getAnnotation(PrototypeGenerator.class);
if (generator != null) {
if (generator.name() != null && !generator.name().isEmpty()) {
return applicationContext.getBean(generator.name(), arg0.getArguments());
} else {
Class<?> retType = arg0.getMethod().getReturnType();
String[] beanNames = applicationContext.getBeanNamesForType(retType);
if (beanNames.length == 0) {
throw new IllegalStateException(this + " found no beans of type " + retType);