java.lang.Object
org.miaixz.bus.starter.jdbc.AspectjJdbcProxy
AOP aspect for dynamic datasource switching.
This aspect intercepts methods annotated with DataSource and manages the datasource context before and after
method execution.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafter(org.aspectj.lang.JoinPoint joinPoint, DataSource dataSource) Advice that runs after a method execution withDataSourceannotation.voidbefore(org.aspectj.lang.JoinPoint joinPoint, DataSource dataSource) Advice that runs before a method execution withDataSourceannotation.
-
Constructor Details
-
AspectjJdbcProxy
public AspectjJdbcProxy()
-
-
Method Details
-
before
Advice that runs before a method execution withDataSourceannotation.Sets the datasource context based on the value specified in the annotation. If no datasource is specified, the default datasource will be used.
- Parameters:
joinPoint- the join point representing the method executiondataSource- the datasource annotation on the method
-
after
Advice that runs after a method execution withDataSourceannotation.Cleans up the datasource context based on the configuration in the annotation. If
DataSource.clear()is true, the datasource context will be cleared. Otherwise, the datasource context will be maintained for subsequent operations.- Parameters:
joinPoint- the join point representing the method executiondataSource- the datasource annotation on the method
-