Причина проста. C ++ - один из языков высокого уровня самого низкого уровня. C # и Java часто являются лучшими инструментами для веб-приложения или бизнес-приложения. Никогда для мультимедийного приложения, где размер отпечатка экспоненциально и обратно пропорционален его производительности. ;)
Это вовсе не Kotlin, это устаревшая Java-версия. /servlet/config/annotation/WebMvcConfigurerAdapter.html.
Когда вы «Kotlinize» это в свете методов по умолчанию Java 8 ...
package com.climate.squirrel.web
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
import springfox.documentation.swagger2.annotations.EnableSwagger2
import springfox.documentation.builders.PathSelectors
import springfox.documentation.builders.RequestHandlerSelectors
import springfox.documentation.spi.DocumentationType
import springfox.documentation.spring.web.plugins.Docket
@Configuration
@EnableSwagger2
class SwaggerConfiguration {
@Bean
open fun api(): Docket = Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
@Bean
fun forwardToIndex(): WebMvcConfigurer {
return object : WebMvcConfigurer {
override fun addViewControllers(registry: ViewControllerRegistry) {
registry.addViewController("/").setViewName("redirect:/swagger-ui.html")
}
}
}
}