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

io.seata.solon.integration.XPluginImpl Maven / Gradle / Ivy

There is a newer version: 3.0.0-M4
Show newest version
package io.seata.solon.integration;

import io.seata.rm.GlobalLockTemplate;
import io.seata.solon.annotation.GlobalLock;
import io.seata.solon.impl.GlobalLockInterceptor;
import io.seata.solon.annotation.GlobalTransactional;
import io.seata.solon.impl.GlobalTransactionalInterceptor;
import io.seata.tm.api.TransactionalTemplate;
import org.noear.solon.core.AppContext;
import org.noear.solon.core.Plugin;

/**
 * @author noear
 * @since 2.4
 */
public class XPluginImpl implements Plugin {
    @Override
    public void start(AppContext context) throws Throwable {
        GlobalLockTemplate globalLockTemplate = new GlobalLockTemplate();
        TransactionalTemplate transactionalTemplate = new TransactionalTemplate();

        context.wrapAndPut(GlobalLockTemplate.class, globalLockTemplate);
        context.wrapAndPut(TransactionalTemplate.class, transactionalTemplate);

        context.beanInterceptorAdd(GlobalLock.class, new GlobalLockInterceptor(globalLockTemplate));
        context.beanInterceptorAdd(GlobalTransactional.class, new GlobalTransactionalInterceptor(transactionalTemplate));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy