Questions tagged [spring-kotlin]

34 questions
1
vote
0 answers

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:WebTestClient.BodySpec
yyunikov
  • 5,719
  • 2
  • 43
  • 78
0
votes
1 answer

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 coRouter { GET("/directory") {serverRequest -> …
Saher Al-Sous
  • 517
  • 4
  • 15
0
votes
1 answer

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. but couldn't do it for the web, always getting…
Saher Al-Sous
  • 517
  • 4
  • 15
0
votes
1 answer

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 one page to another, except one page that I get…
Saher Al-Sous
  • 517
  • 4
  • 15
0
votes
1 answer

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 more organized?
0
votes
1 answer

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.springframework.web.servlet.View.pathVariables. Although…
chriptus13
  • 705
  • 7
  • 20
0
votes
1 answer

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("/test") suspend fun postSomething():…
0
votes
1 answer

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 timeout. Frontend handles HTTP 403 and shows screen…
yaromir
  • 378
  • 7
  • 17
0
votes
2 answers

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 problem is that I don't know how to tell Spring to…
Ceryni
  • 371
  • 1
  • 5
  • 18
0
votes
1 answer

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 with test configuration when I would setup my db…
ad3luc
  • 192
  • 1
  • 7
  • 22
0
votes
1 answer

[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 COUNT(id) FROM `user` WHERE login !=…
0
votes
1 answer

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 configured @EnableJms in my Application and I also have…
0
votes
2 answers

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, here is the link of the project on…
0
votes
2 answers

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": "hello" } This is directly derived from @Entity like this - fun getMessage(id: Long) =…
krtkush
  • 1,378
  • 4
  • 23
  • 46
0
votes
1 answer

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 roles: @Repository interface RoleRepository :…
IARI
  • 1,217
  • 1
  • 18
  • 35