Dealing with command line arguments and Spring

前端 未结 7 631
孤街浪徒
孤街浪徒 2020-12-13 04:19

When I\'m writing a Spring command line application which parses command line arguments, how do I pass them to Spring? Would I want to have my main() structured so that it f

7条回答
  •  天命终不由人
    2020-12-13 04:49

    Have a look at my Spring-CLI library - at http://github.com/sazzer/spring-cli - as one way of doing this. It gives you a main class that automatically loads spring contexts and has the ability to use Commons-CLI for parsing command line arguments automatically and injecting them into your beans.

提交回复
热议问题