本文整理了Java中org.aspectj.lang.annotation.Aspect
类的一些代码示例,展示了Aspect
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Aspect
类的具体详情如下:
包路径:org.aspectj.lang.annotation.Aspect
类名称:Aspect
暂无
代码示例来源:origin: weibocom/motan
@Component
@Aspect
public class LoggingAspect {
@Autowired(required = false)
private OperationRecordMapper recordMapper;
代码示例来源:origin: spring-projects/spring-framework
/**
* Extract contents from String of form {@code pertarget(contents)}.
*/
private String findPerClause(Class<?> aspectClass) {
String str = aspectClass.getAnnotation(Aspect.class).value();
str = str.substring(str.indexOf('(') + 1);
str = str.substring(0, str.length() - 1);
return str;
}
代码示例来源:origin: qcadoo/mes
@Aspect
@Configurable
@RunIfEnabled(ProductFlowThruDivisionConstants.PLUGIN_IDENTIFIER)
public class CostNormsForMaterialsServiceAspectPFTD {
@Autowired
private ProductionTrackingListenerServicePFTD productionTrackingListenerServicePFTD;
@AfterReturning(pointcut = "execution(private com.qcadoo.model.api.Entity com.qcadoo.mes.costNormsForMaterials.CostNormsForMaterialsService.updateCostsInOrder(com.qcadoo.model.api.Entity))", returning = "order")
public void afterUpdateCostsInOrder(final JoinPoint jp, final Entity order) throws Throwable {
productionTrackingListenerServicePFTD.updateCostsForOrder(order);
}
}
代码示例来源:origin: ctripcorp/apollo
@Aspect
@Component
public class RepositoryAspect {
@Pointcut("execution(public * org.springframework.data.repository.Repository+.*(..))")
public void anyRepositoryMethod() {
}
@Around("anyRepositoryMethod()")
public Object invokeWithCatTransaction(ProceedingJoinPoint joinPoint) throws Throwable {
String name =
joinPoint.getSignature().getDeclaringType().getSimpleName() + "." + joinPoint.getSignature()
.getName();
Transaction catTransaction = Tracer.newTransaction("SQL", name);
try {
Object result = joinPoint.proceed();
catTransaction.setStatus(Transaction.SUCCESS);
return result;
} catch (Throwable ex) {
catTransaction.setStatus(ex);
throw ex;
} finally {
catTransaction.complete();
}
}
}
代码示例来源:origin: shuzheng/zheng
@Aspect
public class LogAspect {
@Autowired
UpmsApiService upmsApiService;
代码示例来源:origin: spring-projects/spring-framework
@Aspect
public static class NamedPointcutAspectWithoutFQN {
@Pointcut("execution(* getAge())")
public void getAge() {
}
@Around("getAge()")
public int changeReturnValue(ProceedingJoinPoint pjp) {
return -1;
}
}
代码示例来源:origin: qcadoo/mes
@Aspect
@Configurable
@RunIfEnabled(DeliveriesToMaterialFlowConstants.PLUGIN_IDENTIFIER)
public class DeliveredProductAddMultiListenersAspect {
@Pointcut("execution(private com.qcadoo.model.api.Entity com.qcadoo.mes.deliveries.listeners.DeliveredProductAddMultiListeners.createDeliveredProduct(..))"
+ "&& args(position, deliveredProductDD)")
public void createDeliveredProduct(Entity position, DataDefinition deliveredProductDD) {
}
@Around("createDeliveredProduct(position, deliveredProductDD)")
public Entity aroundCreateDeliveredProduct(final ProceedingJoinPoint pjp, Entity position, DataDefinition deliveredProductDD)
throws Throwable {
Entity deliveredProduct = (Entity) pjp.proceed();
deliveredProduct.setField(DeliveredProductFieldsDTMF.EXPIRATION_DATE,
position.getStringField(DeliveredProductMultiPositionFields.EXPIRATION_DATE));
return deliveredProduct;
}
}
代码示例来源:origin: qcadoo/mes
@Aspect
@Configurable
@RunIfEnabled(TechSubcontractingConstants.PLUGIN_IDENTIFIER)
public final class MrpAlgorithmStrategyTSResolverAspect extends MrpAlgorithmStrategyResolverAspect {
@Autowired
@Qualifier("mrpAlgorithmStrategyTS")
private MrpAlgorithmStrategy mrpAlgorithmStrategy;
protected MrpAlgorithmStrategy getAlgorithmService() {
return mrpAlgorithmStrategy;
}
}
代码示例来源:origin: yu199195/hmily
/**
* SpringCloudHmilyTransactionAspect.
* @author xiaoyu
*/
@Aspect
@Component
public class SpringCloudHmilyTransactionAspect extends AbstractHmilyTransactionAspect implements Ordered {
@Autowired
public SpringCloudHmilyTransactionAspect(final SpringCloudHmilyTransactionInterceptor springCloudHmilyTransactionInterceptor) {
this.setHmilyTransactionInterceptor(springCloudHmilyTransactionInterceptor);
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}
代码示例来源:origin: alibaba/nacos
@Aspect
public class CapacityManagementAspect {
private static final Logger LOGGER = LoggerFactory.getLogger(CapacityManagementAspect.class);
+ "(request,response,dataId,group,tenant,..)";
@Autowired
private CapacityService capacityService;
@Autowired
private PersistService persistService;
代码示例来源:origin: spring-projects/spring-framework
@Aspect
public static class NamedPointcutAspectFromLibraryWithBinding {
@Around(value="org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactoryTests.Library.integerArgOperation(x)", argNames="x")
public void doubleArg(ProceedingJoinPoint pjp, int x) throws Throwable {
pjp.proceed(new Object[] {x*2});
}
}
代码示例来源:origin: qcadoo/mes
@Aspect
@Configurable
@RunIfEnabled(MaterialRequirementCoverageForOrderConstans.PLUGIN_IDENTIFIER)
public class MRCCriteriaModifiersMRCFOOverideAspect {
public static final String ORDER_PARAMETER = "order";
@Pointcut("execution(public void com.qcadoo.mes.orderSupplies.criteriaModifiers.MRCCriteriaModifiers.baseModifier(..)) "
+ "&& args(scb, filterValue)")
public void baseModifierA(final SearchCriteriaBuilder scb, final FilterValueHolder filterValue) {
}
@Around("baseModifierA(scb, filterValue)")
public void aroundBaseModifier(final ProceedingJoinPoint pjp, final SearchCriteriaBuilder scb,
final FilterValueHolder filterValue) throws Throwable {
if (filterValue.has(ORDER_PARAMETER)) {
scb.add(SearchRestrictions.isNotNull("productType"));
} else {
pjp.proceed();
}
}
}
代码示例来源:origin: qcadoo/mes
@Aspect
@Configurable
@RunIfEnabled(TechSubcontractingConstants.PLUGIN_IDENTIFIER)
public class MaterialRequirementServiceImplTSOverrideAspect {
@Autowired
private MaterialRequirementServiceImplTSOverrideUtil materialRequirementServiceImplTSOverrideUtil;
@Pointcut("execution(public com.qcadoo.mes.technologies.constants.MrpAlgorithm com.qcadoo.mes.materialRequirements.MaterialRequirementServiceImpl.getDefaultMrpAlgorithm(..))")
public void getDefaultMrpAlgorithmExecution() {
}
@Around("getDefaultMrpAlgorithmExecution()")
public MrpAlgorithm aroundGetDefaultMrpAlgorithmExecution(final ProceedingJoinPoint pjp) {
return materialRequirementServiceImplTSOverrideUtil.getDefaultMrpAlgorithm();
}
}
代码示例来源:origin: stylefeng/Guns
@Aspect
@Component
@Order(200)
public class PermissionAop {
@Autowired
private PermissionCheckService check;
代码示例来源:origin: yu199195/hmily
/**
* MotanHmilyTransactionAspect.
* @author xiaoyu
*/
@Aspect
@Component
public class MotanHmilyTransactionAspect extends AbstractHmilyTransactionAspect implements Ordered {
@Autowired
public MotanHmilyTransactionAspect(final MotanHmilyTransactionInterceptor motanHmilyTransactionInterceptor) {
super.setHmilyTransactionInterceptor(motanHmilyTransactionInterceptor);
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}
代码示例来源:origin: spring-projects/spring-framework
@Aspect
public static class MyAspect {
private final AtomicInteger count = new AtomicInteger(0);
@org.aspectj.lang.annotation.Before("execution(* scheduled())")
public void checkTransaction() {
this.count.incrementAndGet();
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-aop
/**
* Extract contents from String of form {@code pertarget(contents)}.
*/
private String findPerClause(Class<?> aspectClass) {
String str = aspectClass.getAnnotation(Aspect.class).value();
str = str.substring(str.indexOf('(') + 1);
str = str.substring(0, str.length() - 1);
return str;
}
代码示例来源:origin: qcadoo/mes
@Aspect
@Configurable
@RunIfEnabled(TechSubcontrForNegotConstants.PLUGIN_IDENTIFIER)
public class OfferDetailsListenersTSFNOverrideAspect {
@Autowired
private OfferDetailsListenersTSFNOverrideUtil offerDetailsListenersTSFNOverrideUtil;
@Pointcut("execution(private com.qcadoo.model.api.Entity com.qcadoo.mes.supplyNegotiations.listeners.OfferDetailsListeners.createOrderedProduct(..)) "
+ " && args(offerProduct)")
public void createOrderedProductExecution(final Entity offerProduct) {
}
@AfterReturning(value = "createOrderedProductExecution(offerProduct)", returning = "orderedProduct")
public void afterCreateDeliveredProductExecution(final Entity offerProduct, final Entity orderedProduct) {
offerDetailsListenersTSFNOverrideUtil.fillOrderedProductOperation(offerProduct, orderedProduct);
}
}
代码示例来源:origin: wuyouzhuguli/FEBS-Shiro
@Aspect
@Component
public class LogAspect {
@Autowired
private FebsProperties febsProperties;
@Autowired
private LogService logService;
代码示例来源:origin: yu199195/hmily
/**
* dubbo impl aspect.
* @author xiaoyu
*/
@Aspect
@Component
public class DubboHmilyTransactionAspect extends AbstractHmilyTransactionAspect implements Ordered {
@Autowired
public DubboHmilyTransactionAspect(final DubboHmilyTransactionInterceptor dubboHmilyTransactionInterceptor) {
super.setHmilyTransactionInterceptor(dubboHmilyTransactionInterceptor);
}
@Override
public int getOrder() {
return Ordered.HIGHEST_PRECEDENCE;
}
}
内容来源于网络,如有侵权,请联系作者删除!