Remember that the SpringFramework consists of about 20 modules or technologies, and the web technology is one of them.
For the web technology, the Spring Framework has the spring-web, spring-webmvc, spring-websocket, andspring-webmvc-portlet modules.
用spring init创建一个spring的项目
spring init -g=com.apres.spring -a=spring-boot-simple --package=com.apress.spring
-name=spring-boot-simple -x
//
This command will create a Maven Java project with a groupId=com.apress.spring,an artifactId=spring-boot-simple, and a package=com.apress.spring with a project’sname=spring-boot-simple. It will be created in the current directory (-x).
在mac下安装spring cli(使用homebrew时)
brew tap pivotal/tap
brew install springboot
如果在linux则使用sdkman很方便
sdk install springboot
spring cli的简单使用
spring run [options] <files> [--] [args]
Executing this command, you will have a web application up and running and listening to port 8080 bydefault, but you can override this by executing the following command:
spring run app.groovy -- --server.port=8888
he test command runs a Spring Groovy script and Java tests. Its syntax is the following:
spring test [options] files [--] [args]
class MyTest{
@Test
void simple() {
String str= "JUnit works with Spring Boot"
assertEquals "JUnit works with Spring Boot",str
}}
spring test test.groovy