Spring - 工厂Bean

工厂Bean

/*User工厂Bean*/
@Component
public class UserFactory implements FactoryBean<User> {
    /*返回*/
    public User getObject() throws Exception {
        User user=new User();
        return user;
    }

    public Class<?> getObjectType() {
        return null;
    }

    /*是否为单例*/
    public boolean isSingleton() {
       return false;
    }
}

posted on 2021-12-08 15:39  每天积极向上  阅读(11)  评论(0编辑  收藏  举报

导航