| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.common.multiDataSource; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.lang.annotation.ElementType; | 
|---|
|  |  |  | import java.lang.annotation.Retention; | 
|---|
|  |  |  | import java.lang.annotation.RetentionPolicy; | 
|---|
|  |  |  | import java.lang.annotation.Target; | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 针对一个数据源(通信中间件应用),多数据源应用中实际只用了一个数据源 | 
|---|
|  |  |  | * 多数据源应用中,通过注解确定某个数据源。 | 
|---|
|  |  |  | * 确定数据源有两种方法: | 
|---|
|  |  |  | * 1、注解明确了数据源: | 
|---|
|  |  |  | * 例如在Services层方法上注解: @DataSourceSingle(“test”), 表示应用数据源test | 
|---|
|  |  |  | * 2、注解不明确数据源: | 
|---|
|  |  |  | * 例如在Services层方法上注解: @DataSourceSingle(), 未明确数据源,需要在AOP实现中确定数据源 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Retention(RetentionPolicy.RUNTIME) | 
|---|
|  |  |  | @Target(ElementType.METHOD) | 
|---|
|  |  |  | public @interface DataSourceSingle { | 
|---|
|  |  |  | String value() default ""; | 
|---|
|  |  |  | } | 
|---|