Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

java - Can you use Dropwizard's configuration framework without having to spin up a webserver?

I have two components to my application: A webserver and a command line application that share a lot of code and resources but start from two separate main classes. I want to be able to share my configuration from the server for the command line application so that I don't have to write separate configuration code for it. Is it possible to use Dropwizard's configuration bundle outside of the context of a server application?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

To start the HTTP Server, you provide server as a CLI argument to the JAR.

To add your own CLI argument runner, you would define a Command class and provide that rahter than server

If you need access to the config file, use ConfiguredCommand


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...