io.jboot.app.JbootApplication Java Examples
The following examples show how to use
io.jboot.app.JbootApplication.
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: WebApplication.java From jboot with Apache License 2.0 | 6 votes |
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 #2
Source File: SwaggerStarter.java From jboot with Apache License 2.0 | 6 votes |
/** * 启动后,访问: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 #3
Source File: DbController.java From jboot with Apache License 2.0 | 6 votes |
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: DubboClientZookeeperDemo.java From jboot with Apache License 2.0 | 5 votes |
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 #5
Source File: WebsocketDemo.java From jboot with Apache License 2.0 | 5 votes |
/** * 运行 main 方法后,访问 http://127.0.0.1:8888/websocketdemo 查看效果 * html 的相关 js 在 resources 下的 websocket.html * * @param args */ public static void main(String[] args) { JbootApplication.setBootArg("undertow.host", "127.0.0.1"); JbootApplication.setBootArg("undertow.port", 8888); JbootApplication.setBootArg("jboot.web.webSocketEndpoint", "io.jboot.test.websocket.WebsocketDemo"); JbootApplication.run(args); }
Example #6
Source File: MetricsInfluxdbController.java From jboot with Apache License 2.0 | 5 votes |
/** * 配置 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 #7
Source File: RedisMqReceiver2.java From jboot with Apache License 2.0 | 5 votes |
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 #8
Source File: AccountApplicaiton.java From jboot with Apache License 2.0 | 5 votes |
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 #9
Source File: StockApplication.java From jboot with Apache License 2.0 | 5 votes |
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 #10
Source File: MotanClientZookeeperDemo.java From jboot with Apache License 2.0 | 5 votes |
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 #11
Source File: RedisMqReceiver1.java From jboot with Apache License 2.0 | 5 votes |
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 #12
Source File: EhCacheTester.java From jboot with Apache License 2.0 | 4 votes |
@Before public void config() { JbootApplication.setBootArg("jboot.cache.type", "ehcache"); }
Example #13
Source File: RedisMqSender.java From jboot with Apache License 2.0 | 4 votes |
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 #14
Source File: ShrioApp.java From jboot with Apache License 2.0 | 4 votes |
public static void main(String[] args) { JbootApplication.setBootArg("jboot.shiro.loginUrl","/shiro/doLogin"); JbootApplication.setBootArg("jboot.shiro.ini","shiro.ini"); JbootApplication.run(args); }
Example #15
Source File: MutilDatasourceController.java From jboot with Apache License 2.0 | 4 votes |
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 #16
Source File: JbootApp.java From xxl-job with GNU General Public License v3.0 | 4 votes |
public static void main(String[] args) { JbootApplication.run(args); }
Example #17
Source File: RedisCacheTester.java From jboot with Apache License 2.0 | 4 votes |
@Before public void config() { JbootApplication.setBootArg("jboot.cache.type", "redis"); JbootApplication.setBootArg("jboot.cache.redis.host", "127.0.0.1"); JbootApplication.setBootArg("jboot.cache.redis.port", "6379"); }
Example #18
Source File: J2CacheTester.java From jboot with Apache License 2.0 | 4 votes |
@Before public void config() { JbootApplication.setBootArg("jboot.cache.type", "j2cache"); }
Example #19
Source File: CaffeineTester.java From jboot with Apache License 2.0 | 4 votes |
@Before public void config() { JbootApplication.setBootArg("jboot.cache.type", "caffeine"); }
Example #20
Source File: HelloWorld.java From jboot with Apache License 2.0 | 4 votes |
public static void main(String[] args){ JbootApplication.run(args); }
Example #21
Source File: Starter.java From jpress with GNU Lesser General Public License v3.0 | 4 votes |
public static void main(String[] args) { JbootApplication.setBootArg("undertow.resourcePath", "classpath:webapp"); JbootApplication.setBootArg("jboot.app.scanner.unScanJarPrefix", unScanJar); JbootApplication.run(args); }
Example #22
Source File: SystemGenerator.java From jpress with GNU Lesser General Public License v3.0 | 4 votes |
public static void main(String[] args) { String dbTables = "user,attachment,menu,option,payment_record,permission,role,utm," + "wechat_menu,wechat_reply," + "member,member_group,member_dist_amount,member_joined_record,member_price," + "user_address,user_amount,user_amount_statement,user_amount_payout," + "coupon,coupon_code,coupon_used_record," + "user_cart,user_order,user_order_item,user_order_delivery,user_order_invoice," + "user_openid,user_favorite,user_tag," + "payment_record"; String optionsTables = "coupon,member,member_group,product,product_category,user_address," + "user_amount_statement,user_amount_payout,user_cart,user_order,user_order_item,user_order_delivery,user_order_invoice," + "payment_record,user_openid,member_joined_record,user_favorite,user_tag"; JbootApplication.setBootArg("jboot.datasource.url", "jdbc:mysql://127.0.0.1:3306/jpress3"); JbootApplication.setBootArg("jboot.datasource.user", "root"); JbootApplication.setBootArg("jboot.datasource.password", "123456"); String modelPackage = "io.jpress.model"; String baseModelPackage = modelPackage + ".base"; String modelDir = PathKit.getWebRootPath() + "/../jpress-model/src/main/java/" + modelPackage.replace(".", "/"); String baseModelDir = PathKit.getWebRootPath() + "/../jpress-model/src/main/java/" + baseModelPackage.replace(".", "/"); System.out.println("start generate...dir:" + modelDir); Set<String> genTableNames = StrUtil.splitToSet(dbTables, ","); MetaBuilder metaBuilder = CodeGenHelpler.createMetaBuilder(); metaBuilder.setGenerateRemarks(true); List<TableMeta> tableMetas = metaBuilder.build(); tableMetas.removeIf(tableMeta -> genTableNames != null && !genTableNames.contains(tableMeta.name.toLowerCase())); new BaseModelGenerator(baseModelPackage, baseModelDir).generate(tableMetas); new ModelGenerator(modelPackage, baseModelPackage, modelDir).generate(tableMetas); String servicePackage = "io.jpress.service"; String apiPath = PathKit.getWebRootPath() + "/../jpress-service-api/src/main/java/" + servicePackage.replace(".", "/"); String providerPath = PathKit.getWebRootPath() + "/../jpress-service-provider/src/main/java/" + servicePackage.replace(".", "/") + "/provider"; new ServiceApiGenerator(servicePackage, modelPackage, apiPath).generate(tableMetas); new ServiceProviderGenerator(servicePackage, modelPackage, providerPath).generate(tableMetas); Set<String> optionsTableNames = StrUtil.splitToSet(optionsTables, ","); if (optionsTableNames != null && optionsTableNames.size() > 0) { tableMetas.removeIf(tableMeta -> !optionsTableNames.contains(tableMeta.name.toLowerCase())); new BaseOptionsModelGenerator(baseModelPackage, baseModelDir).generate(tableMetas); } }
Example #23
Source File: AddonGenerator.java From jpress with GNU Lesser General Public License v3.0 | 4 votes |
private void genCode() { JbootApplication.setBootArg("jboot.datasource.url", dbUrl); JbootApplication.setBootArg("jboot.datasource.user", dbUser); JbootApplication.setBootArg("jboot.datasource.password", dbPassword); String baseModelPackage = modelPackage + ".base"; String modelDir = basePath + "/src/main/java/" + modelPackage.replace(".", "/"); String baseModelDir = basePath + "/src/main/java/" + baseModelPackage.replace(".", "/"); System.out.println("start generate... dir:" + modelDir); MetaBuilder metaBuilder = CodeGenHelpler.createMetaBuilder(); metaBuilder.setGenerateRemarks(true); List<TableMeta> tableMetas = metaBuilder.build(); Set<String> genTableNames = StrUtil.splitToSet(dbTables, ","); tableMetas.removeIf(tableMeta -> genTableNames != null && !genTableNames.contains(tableMeta.name.toLowerCase())); new BaseModelGenerator(baseModelPackage, baseModelDir).generate(tableMetas); new ModelGenerator(modelPackage, baseModelPackage, modelDir).generate(tableMetas); String apiPath = basePath + "/src/main/java/" + servicePackage.replace(".", "/"); String providerPath = basePath + "/src/main/java/" + servicePackage.replace(".", "/") + "/provider"; new ServiceApiGenerator(servicePackage, modelPackage, apiPath).generate(tableMetas); new ServiceProviderGenerator(servicePackage, modelPackage, providerPath).generate(tableMetas); if (genUI) { new AddonUIGenerator(basePath, addonName, modelPackage, tableMetas) .genControllers() .genEdit() .genList(); } Set<String> optionsTableNames = StrUtil.splitToSet(optionsTables, ","); if (optionsTableNames != null && optionsTableNames.size() > 0) { tableMetas.removeIf(tableMeta -> !optionsTableNames.contains(tableMeta.name.toLowerCase())); new BaseOptionsModelGenerator(baseModelPackage, baseModelDir).generate(tableMetas); } }
Example #24
Source File: ModeGenTester.java From jboot with Apache License 2.0 | 4 votes |
public static void main(String[] args) { JbootApplication.setBootArg("jboot.datasource.url", "jdbc:mysql://127.0.0.1:3306/jbootdemo"); JbootApplication.setBootArg("jboot.datasource.user", "root"); String modelPackage = "io.jboot.codegen.test"; String baseModelPackage = modelPackage + ".base"; String modelDir = PathKit.getWebRootPath() + "/src/main/java/" + modelPackage.replace(".", "/"); String baseModelDir = PathKit.getWebRootPath() + "/src/main/java/" + baseModelPackage.replace(".", "/"); System.out.println("start generate..."); System.out.println("generate dir:" + modelDir); new JbootBaseModelGenerator(baseModelPackage, baseModelDir).generate(); new JbootModelGenerator(modelPackage, baseModelPackage, modelDir).generate(); }
Example #25
Source File: ServiceGenTester.java From jboot with Apache License 2.0 | 4 votes |
public static void main(String[] args) { JbootApplication.setBootArg("jboot.datasource.url", "jdbc:mysql://127.0.0.1:3306/jbootdemo"); JbootApplication.setBootArg("jboot.datasource.user", "root"); String basePackage = "io.jboot.codegen.service.test"; String modelPackage = "io.jboot.codegen.model.test"; System.out.println("start generate..."); new JbootServiceInterfaceGenerator(basePackage, modelPackage).generate(); new JbootServiceImplGenerator(basePackage, modelPackage).generate(); System.out.println("service generate finished !!!"); }
Example #26
Source File: GenTester.java From jboot with Apache License 2.0 | 4 votes |
public static void main(String[] args) { JbootApplication.setBootArg("jboot.datasource.url", "jdbc:mysql://127.0.0.1:3306/jbootdemo"); JbootApplication.setBootArg("jboot.datasource.user", "root"); String modelPackage = "io.jboot.codegen.test.model"; String baseModelPackage = modelPackage + ".base"; String modelDir = PathKit.getWebRootPath() + "/src/main/java/" + modelPackage.replace(".", "/"); String baseModelDir = PathKit.getWebRootPath() + "/src/main/java/" + baseModelPackage.replace(".", "/"); System.out.println("start generate..."); System.out.println("generate dir:" + modelDir); new JbootBaseModelGenerator(baseModelPackage, baseModelDir).setGenerateRemarks(true).generate(); new JbootModelGenerator(modelPackage, baseModelPackage, modelDir).generate(); String servicePackage = "io.jboot.codegen.test.service"; new JbootServiceInterfaceGenerator(servicePackage, modelPackage).generate(); new JbootServiceImplGenerator(servicePackage , modelPackage).setImplName("provider").generate(); }
Example #27
Source File: MotanServer1ZookeeperDemo.java From jboot with Apache License 2.0 | 4 votes |
public static void main(String[] args) { // 开启 @RPCBean 自动暴露功能,默认情况下是开启的,无需配置, // 但是此测试代码的 jboot.properties 文件关闭了,这里需要开启下 JbootApplication.setBootArg("jboot.rpc.autoExportEnable", true); 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"); //export JbootApplication.setBootArg("jboot.rpc.motan.defaultExport", "default:28080"); JbootSimpleApplication.run(args); System.out.println("MotanServer1ZookeeperDemo started..."); }
Example #28
Source File: TestAppStater.java From jboot with Apache License 2.0 | 4 votes |
public static void main(String[] args){ JbootApplication.run(args); // JbootRpcApplication.run(args); }
Example #29
Source File: DubboClientNacosDemo.java From jboot with Apache License 2.0 | 4 votes |
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", "nacos"); //注册中心地址,即 nacos 的地址 JbootApplication.setBootArg("jboot.rpc.dubbo.registry.address", "127.0.0.1:8848"); JbootApplication.run(args); }
Example #30
Source File: MotanServer.java From jboot with Apache License 2.0 | 4 votes |
public static void main(String[] args) throws InterruptedException { JbootApplication.setBootArg("jboot.rpc.type", "motan"); // 开启 @RPCBean 自动暴露功能,默认情况下是开启的,无需配置, // 但是此测试代码的 jboot.properties 文件关闭了,这里需要开启下 JbootApplication.setBootArg("jboot.rpc.autoExportEnable", true); // motan 与 dubbo 不一样,motan 需要配置 export, // export 配置内容为 协议ID:端口号,默认的协议 id 为 default JbootApplication.setBootArg("jboot.rpc.motan.defaultExport", "default:28080"); JbootSimpleApplication.run(args); System.out.println("MotanServer started..."); }