Spring boot 1 basics

 

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



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值