Spring boot快速入门
- Spring Boot war包启动
- 什么是Spring boot
- 快速了解Spring Boot
- Spring boot入门实例
- springboot 整合freemarker
- Spring Boot使用FastJson解析JSON数据
- Spring Boot上传文件示例
Spring Boot CLI教程
开源项目
知识点
相关文章
更多最近更新
更多Spring Boot CLI自动导入库和自动main方法
2019-04-29 23:17|来源: 网路
Spring CLI默认自动导入许多库,因此不需要显式导入。 考虑以下groovy脚本。
@RestController class FirstApplication { @RequestMapping("/") String welcome() { "Welcome to Yiibai.Com" } }
这里导入@RestController
,默认情况下,Spring Boot已经包含@RequestMapping
注释。 甚至不需要使用完全限定的名称。可以通过运行应用程序进行检查。
输入以下命令 -
D:\worksp\springboot-cli> spring run FirstApplication.groovy
可以在控制台上看到以下输出 -
. ____ _ __ _ _ /\\ / ___\'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | \'_ | \'_| | \'_ \/ _> | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) \' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.5.RELEASE) ... 2018-09-07 19:22:17.310 INFO 4824 --- [ runner-0] o.s.boot.SpringApplication : Started application in 3.405 seconds (JVM running for 7.021)
自动main方法
不需要为groovy
脚本创建标准的main
方法来初始化spring应用程序。它是由spring boot应用程序自动创建的。
相关问答
更多-
是不是有一款什么手机软件,可以很自然的拉长腿部?不是美图秀秀,有知道的不?[2022-10-20]
spring -
春天的英语怎么读?[2022-05-21]
spring -
Thymeleaf是一个非常强大的替代品。 Thymeleaf将执行文本或html电子邮件(请参阅上面的链接),已经是推荐的一般HTML使用的模板框架 ,而Velocity本身也在文档的同一部分中被弃用。 Thymeleaf is a pretty powerful replacement. Thymeleaf will do text or html email (see the link above), is already a recommended templating framework for ...
-
如何在Spring Boot项目上禁用activiti自动部署(How to disable activiti auto deployment on Spring Boot project)[2022-03-07]
您可以将以下属性添加到Spring启动应用程序中的application.properties文件中(以下示例): spring.activiti.checkProcessDefinitions = true spring.activiti.processDefinitionLocationPrefix = classpath:/processes/ spring.activiti.processDefinitionLocationSuffixes = *.bpmn20.xml, *.bpmn 干杯,格雷 ... -
JSP和Spring Boot(JSP and Spring Boot)[2023-07-29]
您必须在application.properties文件中为jsp文件定义前缀和后缀,如下所示: spring.mvc.view.prefix: /WEB-INF/jsp/ spring.mvc.view.suffix: .jsp You have to define the prefix and suffix for you jsp file in application.properties file like following: spring.mvc.view.prefix: /WEB-INF/j ... -
如果您使用的是spring-boot 1.5+,请使用CXF 3.1.11或更高版本。 这是错误,修复已经进入3.1.11 Please use CXF 3.1.11 or later if you are using spring-boot 1.5+. Here is the bug, the fix has already gone in to 3.1.11
-
Spring BOOT资源(Spring BOOT resources)[2022-06-06]
你不需要在pom.xml配置任何资源,我是这样做的。 URL url = this.getClass().getClassLoader().getResource("file_name_goes_here.txt"); String fileContent = IOUtils.toString(url); 请注意,我使用org.apache.commons.io.IOUtils来获取文件内容。 这就是我在... -
嘲笑Spring Boot(Mocking Spring Boot)[2022-05-26]
在文章的底部有一个指向github repo的链接,其中包含测试的完整源代码。 在那里你可以看到以下行: import static org.mockito.BDDMockito.given; On the bottom of the article there is a link to the github repo with the full source of the test. There you can see the following line: import static org.mock ... -
如何获取应用的Spring Boot(自动)配置列表(How to obtain a list of applied Spring Boot (auto) configurations)[2024-03-12]
构建完工件后,如果启动它,可以获得自动配置报告,包括--debug命令参数: java -jar artifact.jar --debug 或直接将其添加为SpringApplication.run()的参数 SpringApplication.run(WebApp.class, "--debug"); 或者在IDE中,通过在启动配置中添加--debug作为参数。 该报告将如下所示: ========================= AUTO-CONFIGURATION REPORT ======== ... -
Spring Boot是否支持servlet 2.5自动配置?(Does Spring Boot support servlet 2.5 auto-configuration?)[2022-02-28]
那里不止一个问题: 没有什么可以阻止你使用web.xml(它仍然是Servlet规范的一部分)。 现在大多数人更喜欢Java初始化程序。 @EnableAutoConfiguration适用于任何应用程序上下文(它只使用Spring的功能)。 但是开箱即用的Spring Boot没有一个了解SpringApplication的ContextLoaderListener ,所以如果按照你的描述,你会错过Boot的一些好处。 你可能会发现这里有用的东西 。 Spring Boot Actuator依赖于一些Se ...