今天我们尝试Spring Boot整合Kotlin,并决定建立一个非常简单的Spring Boot微服务,使用Kotlin作为编程语言进行编码构建。
创建一个简单的Spring Boot应用程序。我会在这里使用maven构建项目:
<?xml version="1.0" encoding="UTF-8"?><project xmlns:xsi="http://.edurt.ski.service.UserServiceimport org.junit.jupiter.api.AfterAllimport org.junit.jupiter.api.Testimport org.springframework.beans.factory.annotation.Autowiredimport org.springframework.boot.test.context.SpringBootTestimport org.springframework.data.domain.PageRequest@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)class UserServiceTest(@Autowired private val userService: UserService) { @Test fun `get all`() { println(">> Assert blog page title, content and status code") val entity = this.userService.getAll(PageRequest(0, 1)) print(entity.totalPages) }}源码地址:GitHub
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。