// Path: src/main/java/org/smart4j/framework/core/fault/InitializationError.java
// public class InitializationError extends Error {
// 
//     public InitializationError() {
//         super();
//     }
// 
//     public InitializationError(String message) {
//         super(message);
//     }
// 
//     public InitializationError(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InitializationError(Throwable cause) {
//         super(cause);
//     }
// }


import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.smart4j.framework.aop.annotation.Aspect;
import org.smart4j.framework.core.ClassHelper;
import org.smart4j.framework.core.fault.InitializationError;
import org.smart4j.framework.ioc.annotation.Bean;
import org.smart4j.framework.mvc.annotation.Action;
import org.smart4j.framework.tx.annotation.Service;
package org.smart4j.framework.ioc;


/**
 * 初始化相关 Bean 类
 *
 * @author huangyong
 * @since 1.0
 */
public class BeanHelper {

    /**
     * Bean Map（Bean 类 => Bean 实例）
     */
    private static final Map<Class<?>, Object> beanMap = new HashMap<Class<?>, Object>();

    static {
        try {
            // 获取应用包路径下所有的类
            List<Class<?>> classList = ClassHelper.getClassList();
            for (Class<?> cls : classList) {
                // 处理带有 Bean/Service/Action/Aspect 注解的类
                if (cls.isAnnotationPresent(Bean.class) ||
                    cls.isAnnotationPresent(Service.class) ||
                    cls.isAnnotationPresent(Action.class) ||
                    cls.isAnnotationPresent(Aspect.class)) {
                    // 创建 Bean 实例
                    Object beanInstance = cls.newInstance();
                    // 将 Bean 实例放入 Bean Map 中（键为 Bean 类，值为 Bean 实例）
                    beanMap.put(cls, beanInstance);
                }
            }
        } catch (Exception e) {
// Path: src/main/java/org/smart4j/framework/core/fault/InitializationError.java
// public class InitializationError extends Error {
// 
//     public InitializationError() {
//         super();
//     }
// 
//     public InitializationError(String message) {
//         super(message);
//     }
// 
//     public InitializationError(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InitializationError(Throwable cause) {
//         super(cause);
//     }
// }


// Path: src/main/java/org/smart4j/framework/ioc/BeanHelper.java
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.smart4j.framework.aop.annotation.Aspect;
import org.smart4j.framework.core.ClassHelper;
import org.smart4j.framework.core.fault.InitializationError;
import org.smart4j.framework.ioc.annotation.Bean;
import org.smart4j.framework.mvc.annotation.Action;
import org.smart4j.framework.tx.annotation.Service;

package org.smart4j.framework.ioc;


/**
 * 初始化相关 Bean 类
 *
 * @author huangyong
 * @since 1.0
 */
public class BeanHelper {

    /**
     * Bean Map（Bean 类 => Bean 实例）
     */
    private static final Map<Class<?>, Object> beanMap = new HashMap<Class<?>, Object>();

    static {
        try {
            // 获取应用包路径下所有的类
            List<Class<?>> classList = ClassHelper.getClassList();
            for (Class<?> cls : classList) {
                // 处理带有 Bean/Service/Action/Aspect 注解的类
                if (cls.isAnnotationPresent(Bean.class) ||
                    cls.isAnnotationPresent(Service.class) ||
                    cls.isAnnotationPresent(Action.class) ||
                    cls.isAnnotationPresent(Aspect.class)) {
                    // 创建 Bean 实例
                    Object beanInstance = cls.newInstance();
                    // 将 Bean 实例放入 Bean Map 中（键为 Bean 类，值为 Bean 实例）
                    beanMap.put(cls, beanInstance);
                }
            }
        } catch (Exception e) {
            throw new InitializationError("初始化 BeanHelper 出错！", e);