sb.append("return f;");
sb.append("}");
mnew = CtNewMethod.make(sb.toString(), mainClass);
ConstPool cp = mnew.getMethodInfo().getConstPool();
AnnotationsAttribute attr1 = new AnnotationsAttribute(cp,
AnnotationsAttribute.visibleTag);
javassist.bytecode.annotation.Annotation beanAnnotation = new javassist.bytecode.annotation.Annotation(
"org.springframework.context.annotation.Bean", cp);
ArrayMemberValue a = new ArrayMemberValue(cp);
MemberValue[] m = new MemberValue[]{new StringMemberValue(beanName, cp)};
a.setValue(m);
beanAnnotation.addMemberValue("name", a);
javassist.bytecode.annotation.Annotation lazyAnnotation = new javassist.bytecode.annotation.Annotation(
"org.springframework.context.annotation.Lazy", cp);
lazyAnnotation.addMemberValue("value", new BooleanMemberValue(true, cp));
javassist.bytecode.annotation.Annotation scopeAnnotation = new javassist.bytecode.annotation.Annotation(
"org.springframework.context.annotation.Scope", cp);
EnumMemberValue enumValue = new EnumMemberValue(cp);
enumValue.setType("org.springframework.context.annotation.ScopedProxyMode");
enumValue.setValue("TARGET_CLASS");
scopeAnnotation.addMemberValue("proxyMode", enumValue);
scopeAnnotation.addMemberValue("value", new StringMemberValue("idspace", cp));
attr1.addAnnotation(beanAnnotation);
attr1.addAnnotation(lazyAnnotation);
attr1.addAnnotation(scopeAnnotation);
mnew.getMethodInfo().addAttribute(attr1);
mnew.getMethodInfo().addAttribute(attr1);
mnew.getMethodInfo().addAttribute(attr1);
mainClass.addMethod(mnew);
methodCounter += 1;