I’m trying to use Ktorm in my new springboot application, and get myself into problem when trying to use Ktorm entities interfaces as springboot controller parameters. The entity and Controller look like this: I got this exception once calling function addTask(): [HttpMessageConversionException] Type definition error: [simple type, class website.smsqo.entity.Task]; nested exception is: [com.fasterxml.jackson.databind.exc.InvalidDefinitionException] Cannot construct instance of website.smsqo.entity.Task (no Creators,
Tag: kotlin
How to design two seperate authorization/authentication configurations in spring boot?
I want to implement authentication and authorization for spring boot application with this design: First group of endpoints (“/api/**) will have authorization by passing the api-secret-key through requests headers. Authentication should be permitted for all. Second group (/admin/**) will have authentication by hitting the /login endpoint passing username and password where I will have custom UserDetailService. If the authentication is
How to make a custom-shaped Recycler View?
I need to make a recycler view whose elements will wrap around the ImageView (like this: https://imgur.com/a/7NpCHri). Is there a way to implement this? Answer You can create adapter with GridLayoutManager and for items with indexes 6, 7, 10, 11 make empty transparent views. But as it were said in comment it is not appropriate use of RV. Maybe it
How to get days remaining of a date and print hours minutes and seconds Java8
I’m getting from server an UTC date for instance I’d like to know what is the optimal way to calculate remaining days from now. Here’s what I got now : I’m creating a date for 2 days from now as : I’m parsing it to a DateTime joda I can use other if you say so. When doing the diff
Action bar content is not hiding
so i want to use toolbar but when i change DarkActionBar to NoActionBar in the styles,action bar doesnt remove completely and app title is on my toolbar. https://i.stack.imgur.com/0X722.jpg here is my xml code: what can i do? Answer i think you have in MainActivity code like this and you got the result as shown in the screenshot just remove this
Change Isolation level of a transaction in Reactive Postgres Client (Quarkus)
I want to execute some dql/dml queries in a transaction with the isolation level READ_UNCOMMITED. I’m using the reactive postgres client with mutiny with the suggested method withTransaction() from the Quarkus docs, but I couldn’t find any way to change the isolation lvl. Is that possible, and if yes how can I achieve this ? Thx ! Answer You can
Integration tests with WireMock failing because no ALPN Processors are found
I’m writing some integration tests for a Spring Boot application written in Kotlin. To stub some HTTP requests, I’m using WireMock via spring-cloud-contract-wiremock as dependency. Some anonymized sample code from an integration test: While running these tests on my local machine, everything is working fine. On the CI/CD environment it’s failing though with the following error: I did some searching
How to measure execution time of an aync query/request inside Kotlin coroutines
I have a microservice on which I am using Kotlin coroutines to perform a bunch of db queries asynchronously, and I want to monitor the execution time for each one of those queries for potential performance optimization. The implementation I have is like this: As you can see I use Semaphore to limit the number of parallel jobs, and all
Kotlin/java – How to convert a date time string to Instant?
I am trying to create an instance of Instant from date and time strings. Date is formatted like this yyyy-MM-dd. So the values could look like this: I am trying to make a valid instant from this 2 strings like this: I have also tried with it: But, that is not working, I get: Answer You can combine the date
Create a unique string from a selection of data (that is reverse engineerable)
I attempting to write an app that allows users to enter information/data and gives back a unique string that represents that data. I then want someone else (on a different device) to be able to enter that unique string and get back the inputted data from the first user A vastly simplified example is that I have this information from