我使用MapperScannerConfigurer
创建了mybatis dao,
但我不能将Annotation
与mybatis dao一起使用。
顺序是错的?
bean和mybatis dao中的Spring不在资源库中?
可以正常注射,但不能获得类注释
以下是一些配置
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="annotationClass" value="org.springframework.stereotype.Repository"/>
<property name="basePackage" value="com.wecash"/>
<property name="sqlSessionFactoryBeanName" value="masterSqlSessionFactory"/>
</bean>
@Aspect
@Component
public class DataSourceAspect {
public DataSourceAspect(){
System.out.println("init DataSourceAspect ");
}
private final static LoggerWithMDC LOGGER = LoggerWithMDC.getLogger(DataSourceAspect.class,"dataSource");
@Around("@annotation(dataSource)")
public Object processed(ProceedingJoinPoint point, DataSource dataSource) throws Throwable {
System.out.println("-----------------------");
return point.proceed();
}
}