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

cn.com.xuxiaowei.test.CommonsLang3Application Maven / Gradle / Ivy

Go to download

此项目仅用于测试 org.apache.commons:commons-lang3,可独立运行,请勿在项目中引用

The newest version!
package cn.com.xuxiaowei.test;

import java.security.SecureRandom;

/**
 * 仅用于测试
 *
 * @author xuxiaowei
 * @since 0.0.1
 */
public class CommonsLang3Application {

    private static final String NAME = "org.apache.commons:commons-lang3:3.15.0";

    private static final String METHOD = "RandomStringUtils.randomAlphanumeric(8)";

    private static final ThreadLocal RANDOM = ThreadLocal.withInitial(() -> {
        try {
            return SecureRandom.getInstanceStrong();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    });

    public static void main(String[] args) {
        System.out.println("项目地址:https://github.com/xuxiaowei-com-cn/commons-lang3");
        System.out.printf("此项目仅用于测试 %s 中 %s 使用时是否正常%n", NAME, METHOD);
        System.out.printf("如果下方不能正常输出一个随机数后程序正常停止,而是软件卡住无响应,则代表无法运行 %s 中的 %s%n", NAME, METHOD);
        System.out.println("如果在 CentOS 系列中无法运行,请尝试安装运行 rng-tools:");
        System.out.println("\tsudo yum -y install rng-tools");
        System.out.println("\tsudo systemctl enable rngd.service");
        System.out.println("\tsudo systemctl start rngd.service");
        System.out.println(RANDOM.get().nextInt());
        System.out.printf("恭喜,你的电脑可以运行 %s 中的 %s 方法%n", NAME, METHOD);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy