配置如下: <aop:config>
<aop:aspect ref="aspectHello">
<aop:pointcut id="somePointcut" expression="execution(* tao.aspect.service.Component.bussiness(..))"/>
<aop:before pointcut-ref="somePointcut" method="before"/>
</aop:aspect>
</aop:config>
<bean id="aspectHello" class="tao.aspect.AspectHello"></bean>

<bean id="component" class="tao.aspect.service.impl.ComponentImpl"></bean>package tao.aspect.service;public interface Component {
public void business();
}
================================
package tao.aspect.service.impl;import tao.aspect.service.Component;public class ComponentImpl implements Component{

public void business(){
System.out.println("xxxxxxxxx");
}
}
=====================================
package tao.aspect;
public class AspectHello { public void before() {

System.out.println("你好....");
}}
=========================================package tao.aop.test;import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;import tao.aspect.service.Component;public class AspectTest {
public static void main(String[] args) {
       Resource resource = new ClassPathResource("applicationContext.xml");
        BeanFactory factory = new XmlBeanFactory(resource);
        Component com = (Component) factory.getBean("component");
        com.business();
}
}

解决方案 »

  1.   

    <aop:pointcut id="somePointcut" expression="execution(* tao.aspect.service.Component.*(..))"/>试下.
      

  2.   

    <aop:pointcut id="somePointcut" expression="execution(* tao.aspect.service.*.*(..))"/>试下.
      

  3.   

    Resource resource = new ClassPathResource("applicationContext.xml");
    BeanFactory factory = new XmlBeanFactory(resource);问题在这啊 
    改成 applicationContext app = new 。。
    就好了  不知道啥回事。  呵呵  谢谢大家
      

  4.   


    Resource resource = new ClassPathResource("applicationContext.xml");
    BeanFactory factory = new XmlBeanFactory(resource);问题在这啊 
    改成 applicationContext app = new 。。
    就好了  不知道啥回事。  呵呵  谢谢大家