You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by al...@apache.org on 2022/02/18 03:34:28 UTC
[incubator-linkis] 01/02: Fix issue #1507
This is an automated email from the ASF dual-hosted git repository.
alexkun pushed a commit to branch dev-1.1.0-datasource
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
commit 5fee7615d59804119cf0dc549ba222302f07ac03
Author: peacewong <wp...@gmail.com>
AuthorDate: Fri Feb 18 11:00:18 2022 +0800
Fix issue #1507
---
linkis-commons/linkis-module/pom.xml | 7 --
.../apache/linkis/server/conf/Knife4jConfig.scala | 91 ----------------------
2 files changed, 98 deletions(-)
diff --git a/linkis-commons/linkis-module/pom.xml b/linkis-commons/linkis-module/pom.xml
index 6a7c50b..7318362 100644
--- a/linkis-commons/linkis-module/pom.xml
+++ b/linkis-commons/linkis-module/pom.xml
@@ -30,13 +30,6 @@
<artifactId>linkis-module</artifactId>
<dependencies>
- <!--add knif2 dependency-->
- <dependency>
- <groupId>com.github.xiaoymin</groupId>
- <artifactId>knife4j-spring-boot-starter</artifactId>
- <version>${knife4j.version}</version>
- </dependency>
-
<dependency>
<groupId>org.apache.linkis</groupId>
diff --git a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/Knife4jConfig.scala b/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/Knife4jConfig.scala
deleted file mode 100644
index b6ee259..0000000
--- a/linkis-commons/linkis-module/src/main/scala/org/apache/linkis/server/conf/Knife4jConfig.scala
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.linkis.server.conf
-
-import org.springframework.context.annotation.Bean
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
-import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
-import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
-import springfox.documentation.builders.ApiInfoBuilder
-import springfox.documentation.builders.PathSelectors
-import springfox.documentation.builders.RequestHandlerSelectors
-import springfox.documentation.service.ApiInfo
-import springfox.documentation.spi.DocumentationType
-import springfox.documentation.spring.web.plugins.Docket
-import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc
-import org.springframework.beans.factory.annotation.Value
-
-/**
- * it is very easy to enable knife when you want to use apiDoc(based on swagger2)
- * you can follow these steps to enable
- * 1, open application-linkis.yml and set knife4j.production=false
- * 2, open linkis.properties and set wds.linkis.test.mode=true ## it will be renamed as linkis.test.mode in future release
- * 3, restart the service and you can visit http://ip:port/api/rest_j/v1/doc.html
- *
- * or you can use apidoc by following steps without enable wds.linkis.test.mode
- * 1, open application-linkis.yml and set knife4j.production=false
- * 2, open linkis.propertes ,and set wds.linkis.server.user.restful.uri.pass.auth=/api/rest_j/v1/doc.html,/api/rest_j/v1/swagger-resources,/api/rest_j/v1/webjars,/api/rest_j/v1/v2/api-docs
- * 3, restart the service and you can visit http://ip:port/api/rest_j/v1/doc.html
- * 4, in your browser,add dataworkcloud_inner_request=true, bdp-user-ticket-id's value and workspaceId's value into cookie
- */
-@EnableSwagger2WebMvc
-@EnableKnife4j
-@Configuration
-class Knife4jConfig extends WebMvcConfigurer {
-
- @Value("${spring.application.name}") private val appName = "linkis service"
-
- @Bean(Array("defaultApi2"))
- def defaultApi2() : Docket = {
- val docket = new Docket(DocumentationType.SWAGGER_2)
- .apiInfo(apiInfo())
- //分组名称
- .groupName("RESTAPI")
- .select()
- //这里指定Controller扫描包路径
- .apis(RequestHandlerSelectors.basePackage("org.apache.linkis"))
- .paths(PathSelectors.any())
- .build()
- docket
- }
-
- def apiInfo() : ApiInfo ={
- val apiInfo = new ApiInfoBuilder()
- .title(appName)
- .description("Linkis micro service RESTful APIs")
- .version("v1")
- .build()
- apiInfo
- }
-
- override def addResourceHandlers( registry : ResourceHandlerRegistry): Unit = {
- registry.addResourceHandler("/api/rest_j/v1/doc.html**").addResourceLocations("classpath:/META-INF/resources/doc.html")
- registry.addResourceHandler("/api/rest_j/v1/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/")
- }
-
- override def addViewControllers(registry : ViewControllerRegistry ) : Unit = {
- registry.addRedirectViewController("/api/rest_j/v1/v2/api-docs", "/v2/api-docs")
- registry.addRedirectViewController("/api/rest_j/v1/swagger-resources/configuration/ui", "/swagger-resources/configuration/ui")
- registry.addRedirectViewController("/api/rest_j/v1/swagger-resources/configuration/security", "/swagger-resources/configuration/security")
- registry.addRedirectViewController("/api/rest_j/v1/swagger-resources", "/swagger-resources")
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org