You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I notice from the blog entry it should be possible to put stuff on the context for SpEL expressions, but I was not able to implement it.
@Configuration
class MyConfig {
class X : EvaluationContextExtension{
override fun getRootObject(): Any? {
return "de"
}
override fun getExtensionId(): String {
return "myExtension"
}
}
class Y : ReactiveEvaluationContextExtension {
override fun getExtensionId(): String {
return "myExtension"
}
override fun getExtension(): Mono<out EvaluationContextExtension> {
return Mono.just(X())
}
}
@Bean
fun reactiveEvaluationContextExtension() : ReactiveEvaluationContextExtension? {
return Y()
}
}
When using it in a @Query like this:
interface TaskRepository : CoroutineCrudRepository<Task, Long> {
@Query("SELECT * FROM task t WHERE t.locale = ?#{myExtension}")
fun findWithLocale(): Flow<Task>
}
I see
EL1008E: Property or field 'myExtension' cannot be found on object of type 'java.lang.Object[]' - maybe not public or not valid?
In the end I would like to access the request's locale without putting it as a parameter to all controllers and services, e.g.
@Query("... WHERE tl10n.locale = ?#{locale.language}"
The text was updated successfully, but these errors were encountered:
As I notice from the blog entry it should be possible to put stuff on the context for SpEL expressions, but I was not able to implement it.
When using it in a
@Query
like this:I see
In the end I would like to access the request's locale without putting it as a parameter to all controllers and services, e.g.
The text was updated successfully, but these errors were encountered: