Spring transaction AOP causes transaction failure problem

Situation Description First, AOP was enabled, and transactions were enabled at the same time. The TransactionAspect below is a simple AOP aspect with an Around notification. @Aspect @Component public class TransactionAspect {<!– –> @Pointcut(“execution(* com.qhyu.cloud.datasource.service.TransactionService.*(..))”) // the pointcut expression private void transactionLogInfo() {<!– –>} // the pointcut signature /** *Title: around<br> * Description: This Around […]

Application of AOP in actual development

AOP application in actual development 1. Background The company’s business belongs to the B-side, and the existing back-end management and Android client are implemented by separating the front and back ends of the Web. The client supports offline mode. Since it supports offline mode, the problem of data synchronization arises. The Android side uses SQLite […]

Implementation of Spring-SpringAOP

Understanding of Spring AOP OOP stands for object-oriented programming, which is a programming idea, and AOP stands for aspect-oriented programming, which is also a programming idea. Spring AOP: Technical support provided by Spring to make it easier for programmers to implement aspect-oriented programming. A set of mechanisms provided by Spring make it easier for us […]

Use of spring aop

Usage of spring aop 1. Why use spring aop The benefits of object-oriented programming (OOP) are obvious, and the disadvantages are equally obvious. When you need to add a common method to multiple objects that do not have an inheritance relationship, such as logging, performance monitoring, etc., if you use object-oriented programming, you need to […]

[Spring] AOP implementation principle

Register AOP proxy creator In the normal development process, if you want to enable AOP, you will generally use the @EnableAspectJAutoProxy annotation. In this way, when starting, it will register a proxy creator with the Spring container to create a proxy object. AOP uses AnnotationAwareAspectJAutoProxyCreator, which implements SmartInstantiationAwareBeanPostProcessor. It can be seen from the name […]

final finally finalize difference stream stream Stream method mvc aop ioc understanding the difference between Collection and Collections Nacos AP, CP

Method to create thread 1. The class inherits Thread and overrides the run() method 2. The class implements the Runnable interface and overrides the run() method (no return value, no exception will be thrown) 3. Implement the Callable interface and implement the call() method (with a return value and an exception will be thrown) To […]

Implement various notifications of AOP based on annotations

1.Introduce aop related dependencies <!– spring-aop dependency –> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>6.0.2</version> </dependency> <!– spring aspects dependency–> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>6.0.2</version> </dependency> 2. Create target resources ①Interface public interface Calculator { int add(int i,int j); int sub(int i,int j); int mul(int i,int j); int div(int i,int j); } ②Implementation class @Component public class CalculatorImpl implements […]

05-AOP practical application scenarios

AOP practical cases Transaction Control In a business process, multiple DML statements may need to be completed together, so in order to ensure data security, it is necessary to add transaction control code to ensure that multiple DML statements succeed or fail at the same time The code format for controlling transactions for each business […]

SpringBoot AOP + Redis delayed double deletion to ensure data consistency

SpringBoot AOP + Redis Delayed double deletion ensures data consistency 1. Business scenario 1.1 Problems When using Redis as a cache, there will be inconsistencies between the data in Redis and the database data. In the subsequent query process, it will take a long time to check Redis first, thus The occurrence of queried data […]

Dimension uses AOP to add Name

1.Add files 2.DimName annotation, entity use package annotation; import MateTypeEnum; import java.lang.annotation.*; /** * Dictionary translation annotations * * @author pw */ @Documented @Target(ElementType.FIELD)//Can be used on method names @Retention(RetentionPolicy.RUNTIME)// Valid at runtime public @interface DimName {<!– –> /** * This field represents the encoding of the dictionary type */ //Class clazz() default this.clazz(); Class<? […]