Negotiate to Springboot CLI

I had made another try to help me catch up with Java what's happening, this one is about the SpringCLi which helps bootstrap scarffolding a maven project.

The link official can be found Spring Boot CLI, but I think basic uses should be enough for us to quickly dive into the spring world without struggling downloading extracting an extra boilerplate zip file from the official site to start, ok,

Prerequisits:

install the CLi, I have used tool called SDKman to download the cli, in sdkman, use sdk install springboot-cli to install the cli, then the command spring should be ready to use,

1. how to initialize a project?

THe command is spring init --dependencies=web,data-jpa myprojname`date +%s`, I like to create project by timestamp by milliseconds, this will help us create a springboot project with jpa,web; if want to see the exact date, the timestamp can be converted back using "date -d @16443234", the timestamp is the number, if UTC, then just use "date -ud @timestamp",

2. exploring the command "spring init --list", so available commands or services are listed,

3. using spring shell, "spring shell", then we should save typing the sping prefix in commandline, like "version"

4. configuring repository, use the Settings.xml, configure the sections, the file resides in the maven home directory, most often /etc/maven/settings.xml, or we can make a copy in the ~/.m2/settings.xml, most often, since in China, we can use the alicloud public repository in the mirror section,

So, here we should be ready to go for coding in maven, Next post, I may be going for integrating spring-security package and analyzing the source code of the package, then go into the starter and make an authentication endpoint where users won't pass unless verified,

spring help init,, spring init -d=web --buildtool=maven --packagingOrSth=war projName.zip, then unzip, mvn install, jar -jar target/proj.war, visit localhost:8080, here we go, the project is with us,

留下你的评论
评论
2022-3-11 下午10:10
Okay, I think you are actually an advertiser, cause there is the NopCommerce link in the footer section of this site, so you payed this piece of software in some manner, right?
2022-3-11 下午10:15
I hate Maven downloading too many packages just to build almost every time, the Apache repo is not always that smooth you know.