Leonardo Borges
01/18/2022, 12:03 PMtoDomain()
function. But in this case, I don't know how to do it. Since I'm new to sealed class, maybe there is a solution which I haven't found...
The sealed class (domain) is something like:
sealed class TypeInstruction(val type: String) {
data class TypeOne(val isRequired: Boolean, val maxConcurrency: Short) : TypeInstruction(type = "typeOne")
data class TypeTwo(val isRequired: Boolean, val maxAttemps: Short): TypeInstruction(type = "typeTwo")
}
And the resource is:
sealed class TypeInstructionResource(val type: String) {
data class TypeOne(val isRequired: Boolean, val maxConcurrency: Short) : TypeInstruction(type = "typeOne")
data class TypeTwo(val isRequired: Boolean, val maxAttemps: Short): TypeInstruction(type = "typeTwo")
}
Then an extended function:
fun TypeInstructionResource.toDomain() = when(type) {
"typeOne" -> TypeInstruction.TypeOne(isRequired = isRequired, maxConcurrency = maxConcurrency)
"typeTwo" -> TypeInstruction.TypeTwo(isRequired = isRequired, maxAttemps = maxAttemps)
else -> /* */
}
But of course, the extended function does not recognize the "children" values, such as isRequired
. Any suggestions?George
01/19/2022, 9:18 AMhenrik
01/21/2022, 12:22 PM@RestController
class Foo(val bar: Bar, val baz: Baz = Baz("ding"))
bar
and baz
will be autowired automatically as expected. But is it possible to disable autowiring for baz
since it has a default value?Robert
01/25/2022, 6:59 AMdany giguere
01/26/2022, 10:50 PMMichael de Kaste
01/31/2022, 10:12 AMSlackbot
02/02/2022, 6:41 PMSlackbot
02/06/2022, 1:43 AMSecretX
02/06/2022, 9:09 PM@PostMapping
suspend fun uploadFile(@RequestParam file: Mono<FilePart>)
and
@PostMapping
suspend fun uploadFile(@RequestParam file: FilePart)
other than maybe allow the former to not pass any value?Manoj
02/21/2022, 10:41 AMLucas León
02/22/2022, 4:09 AM<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="<http://maven.apache.org/POM/4.0.0>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>"
xsi:schemaLocation="<http://maven.apache.org/POM/4.0.0> <https://maven.apache.org/xsd/maven-4.0.0.xsd>">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demoproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demoproject</name>
<description>demoproject</description>
<properties>
<java.version>1.8</java.version>
<kotlin.version>1.6.10</kotlin.version>
<ktor.version>1.6.7</ktor.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
<dependency>
<groupId>io.projectreactor.kotlin</groupId>
<artifactId>reactor-kotlin-extensions</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-reactor</artifactId>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-core</artifactId>
<version>${ktor.version}</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-cio</artifactId>
<version>${ktor.version}</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-client-serialization</artifactId>
<version>${ktor.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
And this is what I get in IntelliJSourabh Rawat
02/25/2022, 10:46 AM@Component
class Foo {
inline fun foo() {}
}
gives me
inline' modifier is not allowed on virtual members. Only private or final members can be inlined
Manoj
03/02/2022, 10:25 AM@ Value
annotation in spring with Kotlin?Alfy
03/03/2022, 3:21 PM@Autowired
lateinit var builder: Jackson2ObjectMapperBuilder
Manoj
03/06/2022, 5:35 PMConsider defining a bean of type '' in your configuration.
?zero_coding
03/15/2022, 1:53 PMAlfy
03/21/2022, 6:40 PMLucas León
03/23/2022, 10:20 PMManoj
03/25/2022, 2:25 PMEric
03/25/2022, 5:34 PMMETA-INF/aop.xml
. Also, when instrumenting Kotlin classes, it throws org.aspectj.weaver.loadtime.Aj - com/company/<NameOfKotlinClass>MethodAccess java.lang.RuntimeException: Illegal type for StackMapType: 12
.sdeleuze
03/31/2022, 11:49 AMPeter
04/22/2022, 4:47 PMval pollingContext = Executors.newSingleThreadExecutor().asCoroutineDispatcher()
withContext(pollingContext) {
...
}
Anyone any ideas? Thanks!André Martins
05/02/2022, 4:06 PMAndré Martins
05/03/2022, 3:39 PMwithContext(MDCContext())
whenever I put something in MDC, also using Mono contextWrite(Context.of(coroutineContext[MDCContext.Key]?.contextMap ?: emptyMap()))
when calling WebFilter base chain
Although this is not working and I suspect that is due to passing the coroutine context to the ReactorContext somehow I’m not doing it rightAndré Martins
05/03/2022, 6:30 PMefemoney
05/11/2022, 3:49 PMOkan Yıldırım
05/17/2022, 10:50 AM@Query("select id, email from User")
fun getAllIdsAndEmails(): List<Pair<Long, String>>
But sadly I get an error of
No converter found capable of converting from type [org.springframework.data.jpa.repository.query.AbstractJpaQuery$TupleConverter$TupleBackedMap] to type [kotlin.Pair<?, ?>]
SecretX
05/20/2022, 3:43 AMsuspend
functions inside interfaces (like ReactiveMongoRepository
or something similar, but for coroutines)?Slackbot
06/05/2022, 11:31 PMmp
06/09/2022, 8:02 PMmp
06/09/2022, 8:02 PMAdrian Stypiński
06/10/2022, 2:38 PMmp
06/10/2022, 2:39 PMAdrian Stypiński
06/10/2022, 2:40 PMmp
06/10/2022, 2:41 PMch.qos.logback.classic.spi.Configurator
logback wont be able to find it by interface with Service loader =(
https://stackoverflow.com/a/72498725