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

com.nepxion.skeleton.framework.aop.SkeletonBeanPostProcessor Maven / Gradle / Ivy

package com.nepxion.skeleton.framework.aop;

/**
 * 

Title: Nepxion Skeleton

*

Description: Nepxion Skeleton For Freemarker

*

Copyright: Copyright (c) 2017-2050

*

Company: Nepxion

* @author Haojun Ren * @version 1.0 */ import java.util.HashMap; import java.util.Map; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; import com.nepxion.skeleton.engine.exception.SkeletonException; import com.nepxion.skeleton.framework.annotation.SkeletonPlugin; public class SkeletonBeanPostProcessor implements BeanPostProcessor { private Map skeletonPluginMap = new HashMap(); @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { return bean; } @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean.getClass().isAnnotationPresent(SkeletonPlugin.class)) { SkeletonPlugin skeletonPluginAnnotation = bean.getClass().getAnnotation(SkeletonPlugin.class); String pluginName = skeletonPluginAnnotation.name().trim(); if (skeletonPluginMap.containsValue(pluginName)) { throw new SkeletonException("More than one plugin for name=" + pluginName); } skeletonPluginMap.put(bean, pluginName); } return bean; } public Map getSkeletonPluginMap() { return skeletonPluginMap; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy