codecamp

11.4 运行实例程序

At this point, your application should work. Since you used the spring-boot-starter-parent POM, you have a useful run goal that you can use to start the application. Type mvn spring-boot:run from the root project directory to start the application. You should see output similar to the following: 此时,您的应用程序应用起作用了。由于你使用了spring-boot-starter-parentPOM, 所以您可以使用一个(maven)很有用的run 目标(goal)来启动应用程序。在项目根目录下键入mvn spring-boot:run来启动应用程序。您应该看到如下类似输出:

$ mvn spring-boot:run


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::  (v2.0.3.RELEASE)
....... . . .
....... . . . (log output here)
....... . . .
........ Started Example in 2.222 seconds (JVM running for 6.514)

If you open a web browser to localhost:8080, you should see the following output: 如果您网页浏览器

Hello World!

To gracefully exit the application, press ctrl-c.

11.3.2 @EnableAutoConfiguration注解
12. 接下来阅读什么
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

I. SpringBoot文档

1.关于文档

2.获得帮助

3.初始学习步骤

4.工作中使用SpringBoot

5.学习Spring Boot新特性

6.投入生产

7.深入学习

II. 入门指南

8. Spring Boot介绍

9. 系统必要条件

9.1. 支持的Servlet容器

10. Spring Boot安装

10.1. 安装说明(开发人员)

10.1.1 Maven安装

10.1.2 Gradle Installation (空)

10.2. Installing the Spring Boot CLI (空)

10.3. Upgrading from an Earlier Version of Spring Boot (空)

11. 开发第一个Spring Boot应用程序

11.1 创建POM

11.2 添加 Classpath 依赖

11.3 编写实例代码

11.3.1 @RestController和@RequestMapping注解

11.3.2 @EnableAutoConfiguration注解

11.3.3 “main”方法

11.4 运行实例程序

11.5 创建可执行程序(Executable Jar)

12. 接下来阅读什么

III. 使用Spring Boot (空)

13. Build Systems(空)

13.2 Maven(空)

13.2.2 Using Spring Boot without the Parent POM(空)

13.5 Starters(空)

IV. Spring Boot新特性 (空)

V. Actuator执行器 (空)

VI. 部署Spring Boot Applications (空)

VII. Spring Boot CLI (空)

VIII. 构建工具插件(空)

68. Spring Boot Maven Plugin(空)

IX. ‘How-to’guides(空)

X. 附录 (空)

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }