http://theblasfrompas.blogspot.com.au/2015/02/spring-boot-hello-world-from-command.html
If you wanted to extend that demo to include additional dependencies JAR file such as MySQL driver jar file we would do the following
1. You can add extensions to the CLI using the
install
command as shown below to add MySQL driver. This is installed in the LIB folder of the Spring Boot CLI location directory> spring install mysql:mysql-connector-java:5.1.34
2. Package the application into a JAR which now includes the MySQL driver JAR file to enable you to connect to a MySQL instance from your application. You will need to write the code to do that , BUT now the JAR file is packaged in the JAR created to enable you to do that.
> spring jar -cp /usr/local/Cellar/springboot/1.2.1.RELEASE/lib/mysql-connector-java-5.1.34.jar hello.jar hello.groovy
Note: If you find that you reach the limit of the CLI tool, you will probably want to look at converting your application to full Gradle or Maven built “groovy project”
More Information
http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#cli-using-the-cli
No comments:
Post a Comment