如何在springboot⾃定义(切⾯类)中获取数据库连接对象执⾏⾃⼰拼接的sql
最近在做⼀个⾃定义注解+aop实现⼀个修改⼦表时通过注解+aop的⽅式同步更新主表相关字段的值;通过⾃定注解将sql语句拼接好后不知道如何获取springboot中的数据库连接对象执⾏sql语句,请⼤神指教(不想通过最原始的获取配置⽂件的连接参数、获得连接。。。这种⽅式,是想⽤mybatis中的连接)
package com.aop.annotation;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
springboot aopimport org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class SynchroAop {
//  @Pointcut("execution(* cn.gotham.spring_security_ller.*Controller.*(..))")
@Pointcut("@annotation(com.aop.annotation.SynchroMTable)")
public void pointCut() {
}
@Around(value="pointCut()&&@annotation(synchroMTable)")
public Object recordSystemLog(ProceedingJoinPoint joinPoint, SynchroMTable synchroMTable ) throws Throwable {

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。