public class TestBeanChild { int b = 1; public TestBean createDefault() { return new TestBeanDefault(); } }
class TestBeanDefault extends TestBean{ int b=2; }
包外面不能访问类TestBeanDefault
public abstract class TestBean { private int a =0; public void doBean(){ System.out.println("1321"); } }
<bean id="a" class="com.yundaex.wms.config.TestBeanChild" /> <bean id="b" class="com.yundaex.wms.config.TestBeanChild" factory-bean="a" factory-method="createDefault" /> <aop:config proxy-target-class="true"> <aop:aspect ref="ifmAspect"> <aop:pointcut id="ifmAspectPointcut" expression="execution( * com.yundaex.wms.config.TestBean.*(..)) "/> <aop:around method="aroundMethod" pointcut-ref="ifmAspectPointcut"/> </aop:aspect> </aop:config>
@Autowired private TestBean dd;
dd为父类实例其实是子类的cglib的代理对象
时间: 2024-08-27 16:03:19