All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.wicp.tams.common.redis.annotation.RedisPoolAnnotationDo Maven / Gradle / Ivy

/*
 * **********************************************************************
 * Copyright (c) 2022 .
 * All rights reserved.
 * 项目名称:common
 * 项目描述:公共的工具集
 * 版权说明:本软件属andy.zhou([email protected])所有。
 * ***********************************************************************
 */
package net.wicp.tams.common.redis.annotation;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

import lombok.extern.slf4j.Slf4j;
import net.wicp.tams.common.redis.RedisAssit;
import net.wicp.tams.common.redis.pool.AbsPool;
import net.wicp.tams.common.spring.autoconfig.beans.FieldBean;

@Slf4j
public class RedisPoolAnnotationDo extends FieldBean {

	public RedisPoolAnnotationDo(Annotation annotationInst, Field field) {
		super(annotationInst, field);
	}

	@Override
	public Object doWithAnnotation() {
		RedisPool redisPool = (RedisPool) annotationInst;
		AbsPool absPool = RedisAssit.getPool(redisPool.value());
		log.info("初始化redis池【%s】成功", redisPool.value());
		return absPool;
	}

}