声明,使用 spring5.0.7 、JDK8 、maven3.5.4

问题描述: 在spring配置aop切点通配符时候报错,提示信息为:
Type name pattern expected 、一般原因为少了逗号或者括号,检查没有发现这种错误;查看源码瞅瞅;
错误
打开源码,发现原因为 com.baidu前面 少敲了个空格:
发现原因
附上切点通用表达式:

    <!-- 设置aop 、pointcut切入点、  -->
    <aop:config>
        <!-- pointcut切入点   expression切入点表达式、 execution(* 之后一定要有空格 -->
        <aop:pointcut id="pointcutone" expression="execution(* com.baidu.daoImpl.*.*(..))"></aop:pointcut>
        <!--aspect 切面配置  -->
        <aop:aspect id="aspectone" ref="myAspectXml">
            <aop:before method="writeLog" pointcut-ref="pointcutone"></aop:before>
        </aop:aspect>
    </aop:config>
Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐