Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vertx - reading from property/config file

Tags:

vert.x

How to read data from property files? I understand vertx uses '.json' files for storing data but not sure how to create JsonObject from property/config file.

I would like to keep, server port, connection url, db name etc. in to a config file.

like image 286
user3577622 Avatar asked Sep 07 '15 12:09

user3577622


People also ask

How do I read a JSON file in Vertx?

String jsonStr = IOUtils. toString(new FileReader(myFileName)); JsonObject jsonObj = new JsonObject(jsonStr);

What is ConfigRetriever in Vertx?

public interface ConfigRetriever. Defines a configuration retriever that read configuration from ConfigStore and tracks changes periodically. Author: Clement Escoffier.

How do I run a Vertx application?

The application is started; open your browser to http://localhost:8080 and you should see the Hello message. If you change the message in the code and save the file, the application is restarted with the updated message. Hit CTRL+C to stop the application. That's all for the application.

Is Vertx a framework?

Vert. x is a toolkit, not a framework, so it is naturally very composable and embeddable. We have no strong opinion on what your application structure should be like. Select the modules and clients you need and compose them as you craft your application.


1 Answers

you should run your verticle over io.vertx.core.Launcher, then you could add conf option -conf config.panser.json

enter image description here

like image 148
panser Avatar answered Sep 29 '22 08:09

panser