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

com.iqiny.silly.spring.spel.SillyBeanResolver Maven / Gradle / Ivy

/*
 *  Copyright  iqiny.com
 *
 *  https://gitee.com/iqiny/silly
 *
 *  project name:silly-spring
 *  project description:top silly project pom.xml file
 */
package com.iqiny.silly.spring.spel;

import com.iqiny.silly.common.util.SillyThreadDataUtil;
import com.iqiny.silly.core.base.SillyContext;
import org.springframework.expression.AccessException;
import org.springframework.expression.BeanResolver;
import org.springframework.expression.EvaluationContext;

public class SillyBeanResolver implements BeanResolver {

    private final SillyContext sillyContext;

    public SillyBeanResolver(SillyContext sillyContext){
        this.sillyContext = sillyContext;
    }

    @Override
    public Object resolve(EvaluationContext context, String beanName) throws AccessException {
        String category = SillyThreadDataUtil.category();
        return sillyContext.getBean(category, beanName);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy