public Car getInstance(Car car){ this.car = car; Class<?> clazz = car.getClass(); return (Car)Proxy.newProxyInstance(clazz.getClassLoader(),clazz.getInterfaces(),this); }
public void before(){ System.out.println("****************"); }
public void after(){ System.out.println("-----------------"); }
}
1 2 3 4 5 6 7 8
public class Test { public static void main(String[] args) { JdkDriver jdkDriver = new JdkDriver(); Car car = jdkDriver.getInstance(new Baoma()); car.drive(); car.speed(); } }
if (!actualDependentBeans.isEmpty()) { throw new BeanCurrentlyInCreationException(beanName, "Bean with name '" + beanName + "' has been injected into other beans [" + StringUtils.collectionToCommaDelimitedString(actualDependentBeans) + "] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesForType' with the 'allowEagerInit' flag turned off, for example."); } } } }