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

com.sinszm.sofa.support.Constant Maven / Gradle / Ivy

Go to download

高可用服务框架,业务订单基础功能操作组件 Copyright © 2021 智慧程序猿(sinsz.com) All rights reserved.

The newest version!
package com.sinszm.sofa.support;

import com.sinszm.sofa.exception.ApiException;
import com.sinszm.sofa.util.BaseUtil;

import java.util.Optional;
import java.util.function.Supplier;

/**
 * 常数
 *
 * @author admin
 */
public class Constant {

    /**
     * 事务管理器名称常量
     */
    public static final String TRANSACTION_MANAGER = "jpaTransactionManager";

    /**
     * 实体管理器工厂参考
     */
    public static final String ENTITY_MANAGER_FACTORY_REF = "masterTsEntityManagerFactory";

    /**
     * 默认的数据源名称
     */
    public static final String DEFAULT_DATASOURCE_NAME = "h2DataSource";

    /**
     * 默认数据源方言
     */
    public static final String DEFAULT_DATASOURCE_DIALECT = "org.hibernate.dialect.H2Dialect";

    /**
     * 验证的错误信息组装
     *
     * @param message 消息
     * @return {Supplier}
     */
    public static Supplier error(String message) {
        String msg = Optional.ofNullable(message).orElse("系统异常");
        return () -> new ApiException("201", BaseUtil.trim(msg));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy