Spring Boot 2.0 简明教程基于kotlin-(1)(只是记录)

Spring Boot 2.0 简明教程(只是记录)

自己学习过程中的记录,如对您有帮助非常荣幸


话不多说pom.xml文件内容如下


xml version="1.0" encoding="UTF-8"?>
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   4.0.0

   tech.mgl
   frame-base-system
   0.0.1-SNAPSHOT
   jar

   frame-base-system
   base system for mgl.tech

   
      org.springframework.boot
      spring-boot-starter-parent
      2.0.0.RELEASE
       
   

   
      UTF-8
      UTF-8
      1.8
      1.2.20
     
   

   
      
      
         org.springframework.boot
         spring-boot-starter-web
      
      
         com.fasterxml.jackson.module
         jackson-module-kotlin
      
      
         org.jetbrains.kotlin
         kotlin-stdlib-jdk8
      
      
         org.jetbrains.kotlin
         kotlin-reflect
      
   

   
      ${project.basedir}/src/main/kotlin
      ${project.basedir}/src/test/kotlin
      
         
            org.springframework.boot
            spring-boot-maven-plugin
         
         
            kotlin-maven-plugin
            org.jetbrains.kotlin
            
               
                  -Xjsr305=strict
               
               
                  spring
               
            
            
               
                  org.jetbrains.kotlin
                  kotlin-maven-allopen
                  ${kotlin.version}
               
            
         
      
   

新建一个kotlin文件 内容如下:

@RestController
@RequestMapping("/test")
class TestController {

    @RequestMapping("/test")
    fun test(): String? {
        try {
            println("test")

        } catch (e:Exception) {
            e.printStackTrace()
        }
        return MGL_JsonUtils.result(true)
    }
}

启动类文件

@SpringBootApplication
class TestApplication

fun main(args: Array) {
    runApplication(*args)
}

启动 


访问http://localhost:8080/test

你可能感兴趣的:(tomcat,Spring,Spring,Boot)