如何使用Spring Boot和Kotlin启动Web应用程序 [英] How to start the web application with Spring Boot and Kotlin

查看:308
本文介绍了如何使用Spring Boot和Kotlin启动Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读本教程.

本教程说

通过运行BlogApplication.kt的主要功能来启动Web应用程序,然后转到 http://localhost:8080/,您应该会看到一个带有博客"标题的醒目的网页.

Start the web application by running the main function of BlogApplication.kt, and go to http://localhost:8080/, you should see a sober web page with a "Blog" headline.

如何使用Spring Boot和Kotlin启动Web应用程序?

How to start the web application with Spring Boot and Kotlin?

我根据教程写了如下的BlogApplication.kt

I wrote BlogApplication.kt as below according to the tutorial

package com.example.blog

import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication

@SpringBootApplication
class BlogApplication

fun main(args: Array<String>) {
  runApplication<BlogApplication>(*args)
}

我使用Gradle.

推荐答案

两个选项:

  1. 在您的IDE中,右键单击main函数,然后选择运行"
  2. 使用Gradle,在您的终端中运行./gradlew bootRun
  1. In your IDE, right click the main function and choose "Run"
  2. With Gradle, in your terminal, run ./gradlew bootRun

这篇关于如何使用Spring Boot和Kotlin启动Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆