Dany
05/04/2021, 3:07 PMJacob
05/05/2021, 8:55 PMermac10k
05/06/2021, 7:44 AMDennis Schröder
05/09/2021, 11:48 AMinterface ProductDAO : JpaRepository<ProductDTO, UUID>
That I would like to instantiate manually so I can register it via the beans Kotlin DSL like this:
fun beanDeclarations() = beans {
bean<ProductDAO>()
bean<ProductRepository> {
ProductJPARepository(ref())
}
bean<ProductApplicationService> {
ProductApplicationServiceImpl(ref())
}
}
Could find anything in the interweb … @sdeleuzeMichael Böiers
05/11/2021, 7:02 AMMario Ruiz
05/14/2021, 5:30 AMMario Ruiz
05/14/2021, 5:31 AMWolf Logan
05/14/2021, 11:16 PMorg.springframework.boot
Gradle plugin interferes with running JVM tests in my Kotlin MPP project.marzelwidmer
05/17/2021, 7:14 PMspring-cloud-gateway-server-3.0.2
the following message….
Class 'org.springframework.cloud.gateway.route.builder.RouteDslKt' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler
Dany
05/23/2021, 4:13 PMseon:
uri: 123
My SeonConfiguration class:
@Configuration
@ConfigurationProperties(prefix = "seon")
data class SeonConfiguration(
var uri: String = ""
)
My main class:
@SpringBootApplication
@ConfigurationPropertiesScan
@EnableConfigurationProperties
class WadzpayServiceApplication
fun main(args: Array<String>) {
val seonConfiguration: SeonConfiguration = SeonConfiguration()
print(seonConfiguration.uri) //this line prints null
runApplication<WadzpayServiceApplication>(*args)
}
I had been looking all the possibile answers on stackoverflow, getting my head crazy but still can't make it work. Any help would be massively appreciated!marzelwidmer
05/27/2021, 6:27 PMNeil
06/02/2021, 3:16 PMDennis Schröder
06/15/2021, 3:53 PMapplication.yaml
in a functional way?
beans {
bean {
Foo(property("foo.bar.buz"))
}
}
marzelwidmer
06/17/2021, 2:59 PMKotlinSerializationJsonEncoder
in my SpringBoot
app. have maybe somebody a hint
what is wrong in my configuration ….
I get the following exception when I call my backend service.
org.springframework.web.reactive.function.client.WebClientResponseException: 200 OK from UNKNOWN ; nested exception is kotlinx.serialization.json.internal.JsonDecodingException: Unexpected JSON token at offset 7: Encountered an unknown key 'fooBar'.
Use 'ignoreUnknownKeys = true' in 'Json {}' builder to ignore unknown keys.
JSON input: {
"fooBar": "123,345.....
I try to configured it like this:
@Configuration
class WebConfig : WebFluxConfigurer {
//<https://docs.spring.io/spring-framework/docs/current/reference/html/web-reactive.html#webflux-config-message-codecs>
override fun configureHttpMessageCodecs(configurer: ServerCodecConfigurer) {
KotlinSerializationJsonEncoder(
Json {
ignoreUnknownKeys = true
}
)
}
}
jush
06/18/2021, 8:35 AMkotlinx.serialization.json.Json
in our dependencies it is automatically added.Matthew Adams
06/18/2021, 8:03 PM2021.0.1
support Kotlin 1.5
? The docs at https://docs.spring.io/spring-data/mongodb/docs/3.2.1/reference/html/#kotlin.requirements say Spring Data supports Kotlin 1.3...
EricJTurley
06/21/2021, 5:35 PM@ConfigurationProperties("chat-replay")
@ConstructorBinding
data class ChatReplayProperties(
val chatLogPrintInterval: Long,
val poll: Poll,
val generation: Generation,
val query: Query,
val external: External,
) {
But:
• All the chat-replay.generation.*
properties are in a application-genchatlogs.properties
file, so...
• When run with no active Spring Profiles, the Generation
object is null
And application startup fails with ParameterResolutionException
of course.
What's a good pattern for this?Deji
06/22/2021, 8:10 PMinterface Base
data class Derived(val value: String): Base
fun getDerived(): Mono<Derived> = TODO()
fun getBase(): Mono<Base> = getDerived() // this line does not compile
fun getBase2(): Mono<Base> = getDerived().map { it } // this compiles fine
I am new to kotlin so I might be missing something. But is it possible to get the 4th line to compile without mapping it again?
If this isn’t the right place to ask this please let me know the appropriate channel. Thanks!Luca Piccinelli
06/29/2021, 5:58 AMholgerbrandl
07/01/2021, 11:24 AM@JvmInline value class
value in a thymeleaf template it fails with EL1004E: Method call: Method now() cannot be found on type my.org.SimpleFactory
Is this a known problem? Is a workaround? In the IDE it resolves the method correctly, see the attached screenshot:nfrankel
07/02/2021, 12:59 PMEmil Kantis
07/06/2021, 10:46 AMsuspend
fun? I realize the generated continuation might be creating issues with how the caching mechanism works..ianbrandt
07/14/2021, 3:18 PM@ConfigurationProperties
data classes in my project with Kapt, Gradle, and IntelliJ. At some point along the line I started getting a red "Spring Boot Configuration Annotation Processor not configured" banner on my properties classes that wasn't there before.
There's at least some association going on. If I add a property to 'application.properties' that's not in my @ConfigurationProperties
class, I do get a "Cannot resolve configuration property" warning on that property.
I've created a reproducer here: https://github.com/ianbrandt/spring-kapt
I'm fairly certain there were no related changes to my project's configuration other than upgrades of Spring, Kapt, Gradle, and IntelliJ. I'm on the latest release versions of all of the above.
Am I missing something that would cause the red IntelliJ banner to now appear where it hadn't before?Derek Ellis
07/19/2021, 5:18 PM@Serializable
and primitive collections before forwarding everything to Jackson. I've run into an issue where I want to serialize a List
(I believe the implementation is just a regular ArrayList
) of a serializable class that has some @SerialName
annotations on the properties, but it looks like it's being forwarded to Jackson and the @SerialName
names are being ignored.
Is this functionality supported, and how would I update the configuration of my WebFlux project to use kotlinx serialization for this?Jilles Soeters
07/28/2021, 11:33 PMJilles Soeters
07/30/2021, 5:54 PMIterable<T>
and others List<T>
. I believe repositories return a List
of entites so why would anyone specify return type of Iterable
? e.g. https://github.com/spring-guides/tut-spring-boot-kotlin/blob/main/src/main/kotlin/com/example/blog/Repositories.kt#L7efemoney
08/02/2021, 9:57 PMJilles Soeters
08/11/2021, 7:23 PMselect_related
to make it eager. Is there a way to load a lazy relationship eagerly in Spring JPA without having to do entities.forEach { it.lazy_loaded_attribute }
or something?Adrian Cruz
08/13/2021, 12:56 PM@RequestBody body: MyDataClass
to get a deserialized object of the payload. but my problem is that i need to pass in the body as a String to validate the signature properly. Is there a proper way to handle this? or do i just update to @RequestBody body: String
, then do validation, and finally do a manual ObjectMapper
to MyDataClass
?marzelwidmer
08/15/2021, 3:32 PMup&running.
https://github.com/marzelwidmer/kboot-native
[INFO] [creator] Native Image: Contributing to layer
[INFO] [creator] GraalVM 21.2.0 Java 11 CE (Java Version 11.0.12+6-jvmci-21.2-b08)
[INFO] [creator] Executing native-image -H:+StaticExecutableWithDynamicLibC -H:Name=/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt -cp /workspace:/workspace/BOOT-INF/classes:/workspace/BOOT-INF/lib/spring-native-0.10.0.jar:/workspace/BOOT-INF/lib/spring-boot-2.5.3.jar:/workspace/BOOT-INF/lib/spring-context-5.3.9.jar:/workspace/BOOT-INF/lib/spring-aop-5.3.9.jar:/workspace/BOOT-INF/lib/spring-expression-5.3.9.jar:/workspace/BOOT-INF/lib/spring-boot-autoconfigure-2.5.3.jar:/workspace/BOOT-INF/lib/logback-classic-1.2.4.jar:/workspace/BOOT-INF/lib/logback-core-1.2.4.jar:/workspace/BOOT-INF/lib/log4j-to-slf4j-2.14.1.jar:/workspace/BOOT-INF/lib/log4j-api-2.14.1.jar:/workspace/BOOT-INF/lib/jul-to-slf4j-1.7.32.jar:/workspace/BOOT-INF/lib/jakarta.annotation-api-1.3.5.jar:/workspace/BOOT-INF/lib/snakeyaml-1.28.jar:/workspace/BOOT-INF/lib/jackson-datatype-jdk8-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-datatype-jsr310-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-module-parameter-names-2.12.4.jar:/workspace/BOOT-INF/lib/reactor-netty-http-1.0.9.jar:/workspace/BOOT-INF/lib/netty-codec-http-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-common-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-buffer-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-transport-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-codec-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-handler-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-codec-http2-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-codec-dns-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-native-macos-4.1.66.Final-osx-x86_64.jar:/workspace/BOOT-INF/lib/netty-transport-native-unix-common-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-transport-native-epoll-4.1.66.Final-linux-x86_64.jar:/workspace/BOOT-INF/lib/reactor-netty-core-1.0.9.jar:/workspace/BOOT-INF/lib/netty-handler-proxy-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-codec-socks-4.1.66.Final.jar:/workspace/BOOT-INF/lib/spring-web-5.3.9.jar:/workspace/BOOT-INF/lib/spring-beans-5.3.9.jar:/workspace/BOOT-INF/lib/spring-webflux-5.3.9.jar:/workspace/BOOT-INF/lib/jackson-module-kotlin-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-databind-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-core-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-annotations-2.12.4.jar:/workspace/BOOT-INF/lib/reactor-kotlin-extensions-1.1.3.jar:/workspace/BOOT-INF/lib/reactor-core-3.4.8.jar:/workspace/BOOT-INF/lib/reactive-streams-1.0.3.jar:/workspace/BOOT-INF/lib/kotlin-reflect-1.5.21.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-1.5.21.jar:/workspace/BOOT-INF/lib/annotations-13.0.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-common-1.5.21.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-jdk8-1.5.21.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-jdk7-1.5.21.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-reactor-1.5.1.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-reactive-1.5.1.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-core-jvm-1.5.1.jar:/workspace/BOOT-INF/lib/slf4j-api-1.7.32.jar:/workspace/BOOT-INF/lib/spring-core-5.3.9.jar:/workspace/BOOT-INF/lib/spring-jcl-5.3.9.jar:/workspace/BOOT-INF/lib/spring-boot-jarmode-layertools-2.5.3.jar com.example.demo.KbootNativeApplicationKt
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] classlist: 3,477.37 ms, 1.19 GB
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] (cap): 523.64 ms, 1.19 GB
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] setup: 2,577.28 ms, 1.19 GB
[INFO] [creator] To see how the classes got initialized, use --trace-class-initialization=org.springframework.util.unit.DataSize
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] analysis: 10,754.71 ms, 1.54 GB
[INFO] [creator] Error: Classes that should be initialized at run time got initialized during image building:
[INFO] [creator] org.springframework.util.unit.DataSize was unintentionally initialized at build time. To see why org.springframework.util.unit.DataSize got initialized use --trace-class-initialization=org.springframework.util.unit.DataSize
[INFO] [creator]
[INFO] [creator] Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] [total]: 17,145.94 ms, 1.54 GB
[INFO] [creator] # Printing build artifacts to: /layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt.build_artifacts.txt
[INFO] [creator] Error: Image build request failed with exit status 1
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to contribute native-image layer
[INFO] [creator] error running build
[INFO] [creator] exit status 1
[INFO] [creator] ERROR: failed to build: exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
marzelwidmer
08/15/2021, 3:32 PMup&running.
https://github.com/marzelwidmer/kboot-native
[INFO] [creator] Native Image: Contributing to layer
[INFO] [creator] GraalVM 21.2.0 Java 11 CE (Java Version 11.0.12+6-jvmci-21.2-b08)
[INFO] [creator] Executing native-image -H:+StaticExecutableWithDynamicLibC -H:Name=/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt -cp /workspace:/workspace/BOOT-INF/classes:/workspace/BOOT-INF/lib/spring-native-0.10.0.jar:/workspace/BOOT-INF/lib/spring-boot-2.5.3.jar:/workspace/BOOT-INF/lib/spring-context-5.3.9.jar:/workspace/BOOT-INF/lib/spring-aop-5.3.9.jar:/workspace/BOOT-INF/lib/spring-expression-5.3.9.jar:/workspace/BOOT-INF/lib/spring-boot-autoconfigure-2.5.3.jar:/workspace/BOOT-INF/lib/logback-classic-1.2.4.jar:/workspace/BOOT-INF/lib/logback-core-1.2.4.jar:/workspace/BOOT-INF/lib/log4j-to-slf4j-2.14.1.jar:/workspace/BOOT-INF/lib/log4j-api-2.14.1.jar:/workspace/BOOT-INF/lib/jul-to-slf4j-1.7.32.jar:/workspace/BOOT-INF/lib/jakarta.annotation-api-1.3.5.jar:/workspace/BOOT-INF/lib/snakeyaml-1.28.jar:/workspace/BOOT-INF/lib/jackson-datatype-jdk8-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-datatype-jsr310-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-module-parameter-names-2.12.4.jar:/workspace/BOOT-INF/lib/reactor-netty-http-1.0.9.jar:/workspace/BOOT-INF/lib/netty-codec-http-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-common-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-buffer-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-transport-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-codec-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-handler-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-codec-http2-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-codec-dns-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-resolver-dns-native-macos-4.1.66.Final-osx-x86_64.jar:/workspace/BOOT-INF/lib/netty-transport-native-unix-common-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-transport-native-epoll-4.1.66.Final-linux-x86_64.jar:/workspace/BOOT-INF/lib/reactor-netty-core-1.0.9.jar:/workspace/BOOT-INF/lib/netty-handler-proxy-4.1.66.Final.jar:/workspace/BOOT-INF/lib/netty-codec-socks-4.1.66.Final.jar:/workspace/BOOT-INF/lib/spring-web-5.3.9.jar:/workspace/BOOT-INF/lib/spring-beans-5.3.9.jar:/workspace/BOOT-INF/lib/spring-webflux-5.3.9.jar:/workspace/BOOT-INF/lib/jackson-module-kotlin-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-databind-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-core-2.12.4.jar:/workspace/BOOT-INF/lib/jackson-annotations-2.12.4.jar:/workspace/BOOT-INF/lib/reactor-kotlin-extensions-1.1.3.jar:/workspace/BOOT-INF/lib/reactor-core-3.4.8.jar:/workspace/BOOT-INF/lib/reactive-streams-1.0.3.jar:/workspace/BOOT-INF/lib/kotlin-reflect-1.5.21.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-1.5.21.jar:/workspace/BOOT-INF/lib/annotations-13.0.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-common-1.5.21.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-jdk8-1.5.21.jar:/workspace/BOOT-INF/lib/kotlin-stdlib-jdk7-1.5.21.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-reactor-1.5.1.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-reactive-1.5.1.jar:/workspace/BOOT-INF/lib/kotlinx-coroutines-core-jvm-1.5.1.jar:/workspace/BOOT-INF/lib/slf4j-api-1.7.32.jar:/workspace/BOOT-INF/lib/spring-core-5.3.9.jar:/workspace/BOOT-INF/lib/spring-jcl-5.3.9.jar:/workspace/BOOT-INF/lib/spring-boot-jarmode-layertools-2.5.3.jar com.example.demo.KbootNativeApplicationKt
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] classlist: 3,477.37 ms, 1.19 GB
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] (cap): 523.64 ms, 1.19 GB
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] setup: 2,577.28 ms, 1.19 GB
[INFO] [creator] To see how the classes got initialized, use --trace-class-initialization=org.springframework.util.unit.DataSize
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] analysis: 10,754.71 ms, 1.54 GB
[INFO] [creator] Error: Classes that should be initialized at run time got initialized during image building:
[INFO] [creator] org.springframework.util.unit.DataSize was unintentionally initialized at build time. To see why org.springframework.util.unit.DataSize got initialized use --trace-class-initialization=org.springframework.util.unit.DataSize
[INFO] [creator]
[INFO] [creator] Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[INFO] [creator] [/layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt:183] [total]: 17,145.94 ms, 1.54 GB
[INFO] [creator] # Printing build artifacts to: /layers/paketo-buildpacks_native-image/native-image/com.example.demo.KbootNativeApplicationKt.build_artifacts.txt
[INFO] [creator] Error: Image build request failed with exit status 1
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to contribute native-image layer
[INFO] [creator] error running build
[INFO] [creator] exit status 1
[INFO] [creator] ERROR: failed to build: exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Woop Woop Woop
I found it …. the Spring AOT plugin
was missing 🙈nfrankel
08/15/2021, 3:55 PMError: Classes that should be initialized at run time got initialized during image building:
[INFO] [creator] org.springframework.util.unit.DataSize was unintentionally initialized at build time. To see why org.springframework.util.unit.DataSize got initialized use --trace-class-initialization=org.springframework.util.unit.DataSize
i’d suggest you to add `
--initialize-at-build-time=org.springframework.util.unit.DataSize
but this is not kotlin relatedmarzelwidmer
08/15/2021, 3:55 PM. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.5.3)
2021-08-15 15:54:58.230 INFO 1 --- [ main] o.s.boot.SpringApplication : Starting application using Java 11.0.12 on df5ff410afff with PID 1 (started by cnb in /workspace)
2021-08-15 15:54:58.230 INFO 1 --- [ main] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2021-08-15 15:54:58.267 INFO 1 --- [ main] o.s.b.web.embedded.netty.NettyWebServer : Netty started on port 8080
2021-08-15 15:54:58.268 INFO 1 --- [ main] o.s.boot.SpringApplication : Started application in 0.05 seconds (JVM running for 0.052)
spring-aot-maven-plugin
<!-- TODO -->
<plugin>
<groupId>org.springframework.experimental</groupId>
<artifactId>spring-aot-maven-plugin</artifactId>
<version>0.10.2</version>
<executions>
<execution>
<id>test-generate</id>
<goals>
<goal>test-generate</goal>
</goals>
</execution>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>