Skip to content

Commit 3bb4972

Browse files
committed
fix kotlin spring boot configuration conflict
1 parent e914c40 commit 3bb4972

File tree

14 files changed

+28
-14
lines changed
  • modules/openapi-generator/src/main/resources/kotlin-spring
  • samples/server/petstore
    • kotlin-spring-default/src/main/kotlin/org/openapitools/api
    • kotlin-springboot/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-3/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api
    • kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api

14 files changed

+28
-14
lines changed

modules/openapi-generator/src/main/resources/kotlin-spring/exceptions.mustache

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package {{apiPackage}}
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("{{apiPackage}}.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-spring-default/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-3/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-bigdecimal-default/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-delegate-nodefaults/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-delegate/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-integer-enum/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-modelMutable/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-multipart-request-model/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-request-cookie/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-source-swagger1/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-source-swagger2/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot-springfox/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/Exceptions.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.springframework.context.annotation.Configuration
34
import org.springframework.http.HttpStatus
45
import org.springframework.web.bind.annotation.ControllerAdvice
56
import org.springframework.web.bind.annotation.ExceptionHandler
@@ -11,7 +12,7 @@ sealed class ApiException(msg: String, val code: Int) : Exception(msg)
1112

1213
class NotFoundException(msg: String, code: Int = HttpStatus.NOT_FOUND.value()) : ApiException(msg, code)
1314

14-
15+
@Configuration("org.openapitools.api.DefaultExceptionHandler")
1516
@ControllerAdvice
1617
class DefaultExceptionHandler {
1718

0 commit comments

Comments
 (0)