Questions tagged [spring-kotlin]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
749 views

why doesn't spring boot 2.7.x use kotlin 1.7 or 1.8

I would like to come up with some empirical evidence for, or against, migrating spring boot 2.7.x to kotlin >= 1.7.x. Looking at the spring boot documentation, kotlin version 1.6.21 is listed. ...
Jolley71717's user avatar
0 votes
1 answer
122 views

Spring in Kotlin: Extracting Object from ServerRequest

I'm building a Spring microserves that is using Functional coRouter @Bean fun directoryRoutes(phoneDirectoryController: PhoneDirectoryController): RouterFunction<*> { return ...
Saher Al-Sous's user avatar
0 votes
1 answer
145 views

Spring in Kotlin: Reactive Functional Router for Rest & Web

I'm looking for a clear documentation on how I can create a Router for Spring Webflux in kotlin that directs the user for both Rest and web Endpoints. I made router to do the rest points with no issue....
Saher Al-Sous's user avatar
1 vote
3 answers
3k views

Spring Boot 3.0 with Jpa 3.1 instantiation in query not working

Since the upgrade to Spring Boot 3.0 following query is not working anymore: @Query(""" select new com.example.OrderProductWithAmount( op, sum(op.amount), sum(op....
kaulex's user avatar
  • 2,941
2 votes
1 answer
1k views

Spring in Kotlin: from 5.3 to 6.0 security Configuration

I'm facing lots of issues in doing Spring security configurations that I used to have in v5.3 applied in v6. This is the file I had @Configuration @EnableWebSecurity class WebSecurityConfiguration : ...
Saher Al-Sous's user avatar
0 votes
1 answer
40 views

Spring in Kotlin: Spring Security gives me forbidden message despite i'm logged in

I have my spring server working already. I added the spring-security dependency to the gradle. logged in with the provided password, I can access all the pages with their links directly, and move from ...
Saher Al-Sous's user avatar
0 votes
1 answer
217 views

How to reduce or organize swagger declarations with Kotlin

how can I organize the swagger annotations, for example I have an endpoint that catches all the users, so the swagger statements were huge. Is there any way I can organize this in another file to be ...
Igor Bittencourt's user avatar
1 vote
1 answer
171 views

kotlin delegated field is always null when loaded from hibernate

I'm trying to do something that would be simple as hell in java but kotlin came to make it a nightmare. interface IChargeableDTO{ var name: String var ref: String var priceCents: Int ...
Rafael Lima's user avatar
  • 3,118
0 votes
1 answer
298 views

How to get requests path with unresolved variables in Spring WebFlux

I'm trying to get the request's path with unresolved path variables in a WebFilter. I know in SpringBoot Servlet version it is possible to do this by getting request's attribute with key org....
chriptus13's user avatar
0 votes
1 answer
1k views

How to pass context back into the WebFilter when using SpringBootWebFlux with coroutines

Suppose I have the following application with a WebFilter and I'm trying to pass some context back from the controller into the filter. @RestController class MyController { @PostMapping("/...
chriptus13's user avatar
2 votes
0 answers
380 views

RestTemplate to WebClient

I'm migrating usage of RestTemplate to WebClient, following is my existing RestTemplate code, val restTemplate: RestTemplate @Throws(KeyStoreException::class, NoSuchAlgorithmException::class, ...
Vignesh's user avatar
  • 3,571
0 votes
1 answer
1k views

Spring Security OAuth 2.0 Google: redirect to default URL after unauthorized request instead of requested URL

I'm using Spring Security OAuth 2.0 with Google as identity provider. I have problem with proper handling of session timeout and reauthentication. Scenario: Some request to REST API after session ...
yaromir's user avatar
  • 376
0 votes
2 answers
1k views

Spring Kotlin @ConfigurationProperties for data class defined in dependency

I've got a library that has a configuration class (no spring configuration class) defined as a data class. I want a Bean of that configuration which can be configured via application.properties. The ...
Ceryni's user avatar
  • 371
0 votes
1 answer
306 views

Configuration DbSetup with Kotlin and Spring Boot

I'm developing Kotlin application with gradle Java 11 Spring Boot 2.3.6.RELEASE DbSetup-kotlin:2.1.0 testcontainers:postgresql 1.15.0 After following this guide DbSetup Kotlin I'm facing problem ...
ad3luc's user avatar
  • 192
0 votes
1 answer
899 views

[R2DBC-Spring-Data-kofu]:Expressing distinct in criteria API

Hello I try to convert a jpql query to the criteria api. the sql query is SELECT COUNT(DISTINCT id) FROM `user` WHERE login != :anonymousUser I've just succeed to reach this query with criteria SELECT ...
cheroliv's user avatar
  • 113
0 votes
1 answer
1k views

Unable to write to Azure Service Bus Topic from Spring Boot Application using azure-servicebus-jms-spring-boot-starter

I am trying to push a message onto an azure service bus topic using JMS in Spring Boot. As you can see below I have pulled in the dependancy for azure-servicebus-jms-spring-boot-starter I have ...
Russell Brady's user avatar
0 votes
2 answers
2k views

Spring boot + Kotlin + MongoDb: Cannot resolve reference to bean 'mongoTemplate' while setting bean property

I am trying to make a simple application using kotlin and spring boot which connects to mongodb and makes some operations there, however I am facing this issues. If you guys want to see more details, ...
Lucas Simas's user avatar
4 votes
1 answer
1k views

Spring boot validate each string in a List (kotlin)

I'm struggling with validation in String Boot. I have the following class in Kotlin: class ListBlock( @field:Size(max = 5) val style: String, @field:Valid @field:Size(max = 10) ...
Aslak's user avatar
  • 109
0 votes
2 answers
4k views

How to dynamically add key value pairs in Kotlin object?

I have Spring Boot REST api which returns JSON object like this - { "id": "1" "timestamp": "2020-08-03T08:49:02.679+00:00" "message": "...
krtkush's user avatar
  • 1,388
0 votes
1 answer
948 views

Spring data/Hibernate: detached entity passed to persist

I get "detached entity passed to persist", but I do not understand, how the object in question can be in a detached state. Here is some context first. two JpaRepositorys for each users and ...
IARI's user avatar
  • 1,249
0 votes
2 answers
1k views

return Mono/Flux with 2 nested subscriptions

I need to return Mono / Flux for a function but this has 2 nested subscriptions. I am looking for a better solution to publish Mono/Flux only after this 2 subscription values are available then ...
Ashok Krishnamoorthy's user avatar
0 votes
1 answer
568 views

Kotlin > Spring Boot > Using router DSL, POST Method body, unable to convert JSON to POJOs

I’m trying to build a Petstore Fullstack application using Kotlin Multiplatform. I’m using Spring Router DSL for defining rest endpoints. For the GET method, it worked fine. Then I started working on ...
Chaitanya's user avatar
0 votes
1 answer
2k views

@EnableWebFlux on a WebFluxConfigurer does autoconfigure a ThymeleafViewResolver as expected

I'm building a REST api starting with spring-boot-starter-webflux, but I'd also like the app to serve a swagger UI using a webjar. I need to tweak how the swagger UI initializes, so I've made a @...
UrLicht's user avatar
  • 939
1 vote
1 answer
2k views

Can we build a full stack webapp with kotlin?

Kotlin official documentation tells that it supports web development. And its replacement for java. I am trying to build a web application using Kotlin. So far I read so many blogs, courses and videos ...
Sundar Nivash's user avatar
1 vote
0 answers
1k views

Spring Boot Gradle Driver for test database [h2] is not available

I am using H2 database with Spring Boot project. I have runtime dependency on h2 in build.gradle.kts file, but it is not able to find the driver. Caused by: java.lang.IllegalStateException: Driver ...
Abdul Fatah's user avatar
2 votes
3 answers
667 views

How to register external annotation to be used by spring validation

I have a library that defines some annotations. This annotation can be added to my requests, I would like to glue that annotation to some custom Validator. External lib Annotation class @Target( ...
Mikooos's user avatar
  • 5,360
0 votes
0 answers
594 views

Request body is empty when no authentication is present for secure APIs

I am trying to log the request body on all requests in a spring boot reactive application secured with spring security. But I am running into an issue where the request body is logged only if the ...
Janani Subbiah's user avatar
4 votes
0 answers
612 views

How can I enable auto build and auto restart with spring boot kotlin intellij

I want to rebuild project automatically when i edit project files. So, I tried spring-boot-devtools, and Intellij seettings. I Checked this page. Hoever, I always have to restart project manually ...
久保圭司's user avatar
1 vote
1 answer
702 views

Is there plans to add Kotlin support for the Spring Tools Suite?

I want to use Kotlin with the Spring Tools suite plugin for VSCode but it only supports Java (For things like intellisense). I know I should just use intelliJ and I will for now but I program in a ...
ChrisAtMachine's user avatar
1 vote
1 answer
2k views

Why queryForObject Kotlin extension func returns nullable T? if it actually will throw EmptyResultDataAccessException?

Using Kotlin and Spring 5 for some simple project. I would like to get single record from database by id using queryForObject. My query is a 'simple select by id': jdbc.queryForObject("select id, ...
Kirill's user avatar
  • 6,802
1 vote
1 answer
1k views

Spring @RestController is not mapping URL with Kotlin

I've created a Kotlin gradle project using Spring IO. Created a Controller class with a method to return a String. When I build and run the project I'm getting 404 error. Looking at the logs I don'...
chattambigeek's user avatar
2 votes
2 answers
2k views

Spring Kotlin DSL: get all beans of certain type

Suppose I have an interface Yoyo and different realizations of this interface: interface Yoyo { fun haha() { println("hello world") } } @Component class Yoyo1 : Yoyo @...
maslick's user avatar
  • 2,923
2 votes
1 answer
2k views

Spring WebClient extract JsonPath value

I'm using Spring 5 WebClient test features and would like to extract body matched by the jsonPath expression but can't find any suitable way of doing it. For example (the code is in Kotlin but I hope ...
yyunikov's user avatar
  • 5,719
1 vote
0 answers
483 views

Kotlin generic issue, should be subtype of Nothing

I'm writing a simple Spring test on Kotlin and have a compilation error with generics that I can't understand. The function is below: @Test fun actuatorRootReturnsOnlyAllowed() { val expectBody:...
yyunikov's user avatar
  • 5,719