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

org.nutz.boot.starter.PreventDuplicateSubmitStarter Maven / Gradle / Ivy

There is a newer version: 2.5.1.v20220215
Show newest version
package org.nutz.boot.starter;

import org.nutz.boot.AppContext;
import org.nutz.boot.starter.nutz.mvc.PreventDuplicateSubmitProcessor;
import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;

/**
 * @author 黄川 [email protected]
 * @date: 2018/8/14
 * 描述此类:
 */
@IocBean(create = "init")
public class PreventDuplicateSubmitStarter {

    private static final Log log = Logs.get();

    @Inject
    protected AppContext appContext;

    public void init() {
        if (appContext != null) {
            log.debug("PreventDuplicateSubmitStarter init ....");
            try {
                PreventDuplicateSubmitProcessor.redisService = appContext.getIoc().getByType(RedisService.class);
            } catch (Exception e) {
                log.debug("PreventDuplicateSubmitStarter 没有开启Redis采用,将采用session存储");
                //如果没有开启Redis就采用session存储,忽略错误
            }
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy