Java Code Examples for io.jboot.app.JbootApplication#run()

The following examples show how to use io.jboot.app.JbootApplication#run() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwaggerStarter.java    From jboot with Apache License 2.0 6 votes vote down vote up
/**
 * 启动后,访问:http://127.0.0.1:8080/swaggerui
 *
 * @param args
 */
public static void main(String[] args) {


    //jboot端口号配置
    JbootApplication.setBootArg("undertow.resourcePath", "src/test/webapp");

    JbootApplication.setBootArg("jboot.swagger.path", "/swaggerui");
    JbootApplication.setBootArg("jboot.swagger.title", "Jboot API 测试");
    JbootApplication.setBootArg("jboot.swagger.description", "这是一个Jboot对Swagger支持的测试demo。");
    JbootApplication.setBootArg("jboot.swagger.version", "1.0");
    JbootApplication.setBootArg("jboot.swagger.termsOfService", "http://jboot.io");
    JbootApplication.setBootArg("jboot.swagger.contactEmail", "[email protected]");
    JbootApplication.setBootArg("jboot.swagger.contactName", "fuhai999");
    JbootApplication.setBootArg("jboot.swagger.contactUrl", "http://jboot.io");
    JbootApplication.setBootArg("jboot.swagger.host", "127.0.0.1:8080");

    JbootApplication.run(args);


}
 
Example 2
Source File: WebApplication.java    From jboot with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {

        //jboot端口号配置
        JbootApplication.setBootArg("undertow.port", "8888");

        //RPC配置
        JbootApplication.setBootArg("jboot.rpc.filter", "seata");
        JbootApplication.setBootArg("jboot.rpc.type", "dubbo");
        JbootApplication.setBootArg("jboot.rpc.callMode", "registry");//注册中心模式
        JbootApplication.setBootArg("jboot.rpc.registryType", "zookeeper");//注册中心的类型:zookeeper
        JbootApplication.setBootArg("jboot.rpc.registryAddress", "127.0.0.1:2181");//注册中心,即zookeeper的地址

        JbootApplication.setBootArg("jboot.seata.enable", true);
        JbootApplication.setBootArg("jboot.seata.failureHandler", "com.alibaba.io.seata.tm.api.DefaultFailureHandlerImpl");
        JbootApplication.setBootArg("jboot.seata.applicationId", "Dubbo_Seata_Business_Service");
        JbootApplication.setBootArg("jboot.seata.txServiceGroup", "dubbo_seata_tx_group");

        JbootApplication.run(args);
    }
 
Example 3
Source File: DbController.java    From jboot with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {

        //设置 数据源 的相关信息
        JbootApplication.setBootArg("jboot.datasource.type", "mysql");
        JbootApplication.setBootArg("jboot.datasource.url", "jdbc:mysql://127.0.0.1:3306/jbootdemo");
        JbootApplication.setBootArg("jboot.datasource.user", "root");
        JbootApplication.setBootArg("jboot.datasource.password", "123456");
        JbootApplication.setBootArg("jboot.model.unscanPackage", "*");
        JbootApplication.setBootArg("jboot.model.scanPackage", "io.jboot.test.db.model");
        JbootApplication.setBootArg("undertow.devMode", "false");

        //启动应用程序
        JbootApplication.run(args);

        Columns columns = Columns.create();
        columns.between("id",1,5);
        List<User> users = new User().findListByColumns(columns);
        System.out.println(Arrays.toString(users.toArray()));

    }
 
Example 4
Source File: StockApplication.java    From jboot with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {

        //jboot端口号配置
        JbootApplication.setBootArg("undertow.port", "8081");
        JbootApplication.setBootArg("jboot.rpc.type", "dubbo");
        JbootApplication.setBootArg("jboot.rpc.callMode", "registry");//注册中心模式
        JbootApplication.setBootArg("jboot.rpc.registryType", "zookeeper");//注册中心的类型:zookeeper
        JbootApplication.setBootArg("jboot.rpc.registryAddress", "127.0.0.1:2181");//注册中心,即zookeeper的地址

        //开启 @RPCBean 自动暴露功能,默认情况下是自动暴露的,但是 jboot.properties 文件关闭了,这里需要开启下
        JbootApplication.setBootArg("jboot.rpc.autoExportEnable", true);
        JbootApplication.setBootArg("jboot.rpc.filter", "seata");
        JbootApplication.setBootArg("jboot.seata.enable", true);
        JbootApplication.setBootArg("jboot.seata.failureHandler", "com.alibaba.io.seata.tm.api.DefaultFailureHandlerImpl");
        JbootApplication.setBootArg("jboot.seata.applicationId", "Dubbo_Seata_Stock_Service");
        JbootApplication.setBootArg("jboot.seata.txServiceGroup", "dubbo_seata_tx_group");

        JbootApplication.setBootArg("jboot.datasource.type", "mysql");
        JbootApplication.setBootArg("jboot.datasource.url", "jdbc:mysql://192.168.0.100:3306/mini?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull");
        JbootApplication.setBootArg("jboot.datasource.user", "root");
        JbootApplication.setBootArg("jboot.datasource.password", "123456");
        
        JbootApplication.setBootArg("jboot.model.unscanPackage", "*");
        JbootApplication.setBootArg("jboot.model.scanPackage", "io.jboot.test.seata.commons");

        JbootApplication.run(args);


        System.out.println("StockApplication started...");


    }
 
Example 5
Source File: RedisMqReceiver1.java    From jboot with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {

        //Undertow端口号配置
        JbootApplication.setBootArg("undertow.port", "8001");

        //设置 mq 的相关信息
        JbootApplication.setBootArg("jboot.mq.type", "redis");
        JbootApplication.setBootArg("jboot.mq.channel", "channel1,channel2,myChannel");
        JbootApplication.setBootArg("jboot.mq.redis.host", "127.0.0.1");

        //启动应用程序
        JbootApplication.run(args);

        //添加监听
        Jboot.getMq().addMessageListener((channel, message) -> {
            System.out.println("listener1 receive msg : " + message + ", from channel : " + channel);
        });

        // 只监听 myChannel 这个通道
        Jboot.getMq().addMessageListener((channel, message) -> {
            System.out.println("listener2 receive msg : " + message + ", from channel : " + channel);
        },"myChannel");

        Jboot.getMq().startListening();

        System.out.println("RedisMqReceiver1 started.");
    }
 
Example 6
Source File: RedisMqReceiver2.java    From jboot with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {

        //Undertow端口号配置
        JbootApplication.setBootArg("undertow.port", "8002");

        //设置 mq 的相关信息
        JbootApplication.setBootArg("jboot.mq.type", "redis");
        JbootApplication.setBootArg("jboot.mq.channel", "channel1,channel2,myChannel");
        JbootApplication.setBootArg("jboot.mq.redis.host", "127.0.0.1");

        //启动应用程序
        JbootApplication.run(args);

        //添加监听
        Jboot.getMq().addMessageListener((channel, message) -> {
            System.out.println("listener1 receive msg : " + message + ", from channel : " + channel);
        });

        // 只监听 myChannel 这个通道
        Jboot.getMq().addMessageListener((channel, message) -> {
            System.out.println("listener2 receive msg : " + message + ", from channel : " + channel);
        },"myChannel");

        Jboot.getMq().startListening();

        System.out.println("RedisMqReceiver1 started.");
    }
 
Example 7
Source File: MetricsInfluxdbController.java    From jboot with Apache License 2.0 5 votes vote down vote up
/**
 * 配置 reporter 为slf4j 输出
 *
 * 当用户访问的时候,log 定时会输出 index() 的访问次数和当前并发量,1分钟输出一次
 * 同时,配置  jboot.metric.url = /metrics_admin
 * 可以通过浏览器访问 /metrics_admin 查看当前的 index() 的并发量和访问次数
 *
 * PS:只有通过浏览器访问 http://127.0.0.1:8888/metrics/influxdb 才会生成 metrics 记录
 *
 * @param args
 */
public static void main(String[] args) {
    JbootApplication.setBootArg("jboot.metric.url", "/metrics_admin");
    JbootApplication.setBootArg("jboot.metric.reporter", "influxdb");

    JbootApplication.setBootArg("jboot.metric.reporter.influxdb.host", "127.0.0.1");
    JbootApplication.setBootArg("jboot.metric.reporter.influxdb.port", 8086);
    JbootApplication.setBootArg("jboot.metric.reporter.influxdb.user", "admin");
    JbootApplication.setBootArg("jboot.metric.reporter.influxdb.password", "123456");
    JbootApplication.setBootArg("jboot.metric.reporter.influxdb.dbName", "metricsDb");

    JbootApplication.run(args);
}
 
Example 8
Source File: DubboClientZookeeperDemo.java    From jboot with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {

        //jboot端口号配置
        JbootApplication.setBootArg("undertow.port", "9999");

        JbootApplication.setBootArg("jboot.rpc.type", "dubbo");

        // dubbo 的注册中心的协议,支持的类型有 dubbo, multicast, zookeeper, redis, consul(2.7.1), sofa(2.7.2), etcd(2.7.2), nacos(2.7.2)
        JbootApplication.setBootArg("jboot.rpc.dubbo.registry.protocol", "zookeeper");
        //注册中心地址,即zookeeper的地址
        JbootApplication.setBootArg("jboot.rpc.dubbo.registry.address", "127.0.0.1:2181");

        JbootApplication.run(args);
    }
 
Example 9
Source File: MotanClientZookeeperDemo.java    From jboot with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {

        //jboot端口号配置
        JbootApplication.setBootArg("undertow.port", "9999");

        JbootApplication.setBootArg("jboot.rpc.type", "motan");

        // motan 的注册中心的协议
        JbootApplication.setBootArg("jboot.rpc.motan.registry.regProtocol", "zookeeper");
        // 注册中心地址,即zookeeper的地址
        JbootApplication.setBootArg("jboot.rpc.motan.registry.address", "127.0.0.1:2181");

        JbootApplication.run(args);
    }
 
Example 10
Source File: AccountApplicaiton.java    From jboot with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args)  {

        //jboot端口号配置
        JbootApplication.setBootArg("undertow.port", "8082");
        JbootApplication.setBootArg("jboot.rpc.filter", "seata");
        JbootApplication.setBootArg("jboot.rpc.type", "dubbo");
        JbootApplication.setBootArg("jboot.rpc.callMode", "registry");//注册中心模式
        JbootApplication.setBootArg("jboot.rpc.registryType", "zookeeper");//注册中心的类型:zookeeper
        JbootApplication.setBootArg("jboot.rpc.registryAddress", "127.0.0.1:2181");//注册中心,即zookeeper的地址

        //开启 @RPCBean 自动暴露功能,默认情况下是自动暴露的,但是 jboot.properties 文件关闭了,这里需要开启下
        JbootApplication.setBootArg("jboot.rpc.autoExportEnable", true);

        JbootApplication.setBootArg("jboot.seata.enable", true);
        JbootApplication.setBootArg("jboot.seata.failureHandler", "com.alibaba.io.seata.tm.api.DefaultFailureHandlerImpl");
        JbootApplication.setBootArg("jboot.seata.applicationId", "Dubbo_Seata_Account_Service");
        JbootApplication.setBootArg("jboot.seata.txServiceGroup", "dubbo_seata_tx_group");
        JbootApplication.setBootArg("jboot.datasource.type", "mysql");
        JbootApplication.setBootArg("jboot.datasource.url", "jdbc:mysql://192.168.0.100:3306/mini?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull");
        JbootApplication.setBootArg("jboot.datasource.user", "root");
        JbootApplication.setBootArg("jboot.datasource.password", "123456");
        JbootApplication.setBootArg("jboot.model.unscanPackage", "*");
        JbootApplication.setBootArg("jboot.model.scanPackage", "io.jboot.test.seata.commons");

        JbootApplication.run(args);



        System.out.println("AccountApplicaiton started...");


    }
 
Example 11
Source File: MotanClient.java    From jboot with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {


        //Undertow端口号配置
        JbootApplication.setBootArg("undertow.port", "9999");

        //RPC配置
        JbootApplication.setBootArg("jboot.rpc.type", "motan");
        JbootApplication.setBootArg("jboot.rpc.autoExportEnable", false);

        //设置直连模式,方便调试,默认为注册中心
        JbootApplication.setBootArg("jboot.rpc.urls", "io.jboot.test.rpc.commons.BlogService:127.0.0.1:28080");


        JbootApplication.run(args);
    }
 
Example 12
Source File: TestAppStater.java    From jboot with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args){
        JbootApplication.run(args);
//        JbootRpcApplication.run(args);
    }
 
Example 13
Source File: DubboClient.java    From jboot with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {


        //Undertow端口号配置
        JbootApplication.setBootArg("undertow.port", "9999");

        //RPC配置
        JbootApplication.setBootArg("jboot.rpc.type", "dubbo");
        JbootApplication.setBootArg("jboot.rpc.autoExportEnable", false);

        //设置直连模式,方便调试,默认为注册中心
        JbootApplication.setBootArg("jboot.rpc.urls", "io.jboot.test.rpc.commons.BlogService:127.0.0.1:28080");


        JbootApplication.run(args);
    }
 
Example 14
Source File: HelloWorld.java    From jboot with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args){
    JbootApplication.run(args);
}
 
Example 15
Source File: DubboClientNacosDemo.java    From jboot with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {

        //jboot端口号配置
        JbootApplication.setBootArg("undertow.port", "9004");

        JbootApplication.setBootArg("jboot.rpc.type", "dubbo");


        // dubbo 的注册中心的协议,支持的类型有 dubbo, multicast, zookeeper, redis, consul(2.7.1), sofa(2.7.2), etcd(2.7.2), nacos(2.7.2)
        JbootApplication.setBootArg("jboot.rpc.dubbo.registry.protocol", "nacos");
        //注册中心地址,即 nacos 的地址
        JbootApplication.setBootArg("jboot.rpc.dubbo.registry.address", "127.0.0.1:8848");



        JbootApplication.run(args);
    }
 
Example 16
Source File: MutilDatasourceController.java    From jboot with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {

        //设置 datasource 1 的相关信息
        JbootApplication.setBootArg("jboot.datasource.type", "mysql");
        JbootApplication.setBootArg("jboot.datasource.url", "jdbc:mysql://127.0.0.1:3306/jbootdemo");
        JbootApplication.setBootArg("jboot.datasource.user", "root");


        //设置 datasource 2 的相关信息
        JbootApplication.setBootArg("jboot.datasource.ds2.type", "mysql");
        JbootApplication.setBootArg("jboot.datasource.ds2.url", "jdbc:mysql://127.0.0.1:3306/jbootdemo");
        JbootApplication.setBootArg("jboot.datasource.ds2.user", "root");


        //启动应用程序
        JbootApplication.run(args);

    }
 
Example 17
Source File: RedisMqSender.java    From jboot with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws InterruptedException {

        //Undertow端口号配置
        JbootApplication.setBootArg("undertow.port", "8000");

        //设置 mq 的相关信息
        JbootApplication.setBootArg("jboot.mq.type", "redis");
        JbootApplication.setBootArg("jboot.mq.redis.host", "127.0.0.1");

        //启动应用程序
        JbootApplication.run(args);

        while (true) {

            Jboot.getMq().publish("message from RedisMqSender", "channel1");
            Jboot.getMq().publish("message from RedisMqSender", "channel2");
            Jboot.getMq().publish("message from RedisMqSender", "myChannel");

            Jboot.getMq().enqueue("message from RedisMqSender by enqueue : " + UUID.randomUUID(), "channel1");

            Thread.sleep(2000);
            System.out.println("jboot mq publish success...");
        }

    }
 
Example 18
Source File: JbootApp.java    From xxl-job with GNU General Public License v3.0 4 votes vote down vote up
public static void main(String[] args) {
    JbootApplication.run(args);
}
 
Example 19
Source File: LocalClient.java    From jboot with Apache License 2.0 3 votes vote down vote up
public static void main(String[] args) {


        //Undertow端口号配置
        JbootApplication.setBootArg("undertow.port", "8888");

        //RPC配置
        JbootApplication.setBootArg("jboot.rpc.type", "local");


        //开启 @RPCBean 自动暴露功能,默认情况下是自动暴露的,但是 jboot.properties 文件关闭了,这里需要开启下
        JbootApplication.setBootArg("jboot.rpc.autoExportEnable", true);

        JbootApplication.run(args);
    }
 
Example 20
Source File: DubboClientZkDemo.java    From jboot with Apache License 2.0 3 votes vote down vote up
public static void main(String[] args) {

        //jboot端口号配置
        JbootApplication.setBootArg("undertow.port", "9003");

        JbootApplication.setBootArg("jboot.rpc.type", "dubbo");


        JbootApplication.setBootArg("jboot.rpc.dubbo.registry.zk.protocol", "zookeeper");
        JbootApplication.setBootArg("jboot.rpc.dubbo.registry.zk.address", "127.0.0.1:2181");


        JbootApplication.run(args);
    }