Evaluation context not correctly set for #Document in Spring 5.x / Spring boot 2.1.6 - mongodb

I am writing a Spring boot application with latest Spring boot 2.1.6 release. There was an issue earlier, which has been discussed both on SO as well as Spring's bug tracker where the Spring EL context did not have access to beans.
This was supposed to have been resolved in Spring 4.x releases. However, I am facing the same problem
References:
SO thread 1
SO thread 2
Spring Data Bug 1043
Spring Data Bug 525
Spring Data Bug 1874
I have tried most of the solutions that were suggested before the actual fix was put in as well.
Right now my code has the annotation like this -
#Document("#{mongoCollectionNameResolver.getCollectionName('BANK')}")
//#Document("BANK")
public class Bank {
}
I have verified that the bean is getting correctly created with the name mentioned in the expression.
I just wanted to ask the community if I am supposed to do anything more for Spring 5.x that I am missing before I reopen the bug / open a new bug with Spring data mongo

When referring to beans with names from SpEL they need to be prefixed # (see the Spring Reference Guide). That being said this means your SpEL expression is wrong.
It should be #{#mongoCollectionNameResolver.getCollectionName('BANK')}.

Related

Spring boot admin client: Is there planned date for support Spring boot 3.0?

There is no version of Spring boot admin client for Spring boot 3.0. Is there planned release?
I'm trying to monitor my application in Spring boot 3 with Spring boot admin client.
I would like to say, it is brilliant tool and thanks maintainers for their work!
There are milestone releases, currently there is 3.0.0-M8, see https://github.com/codecentric/spring-boot-admin/releases/tag/3.0.0-M8
Some things still need to get fixed and all dependencies must be supporting Spring Boot 3.0 first. But you can already use the milestone and if there is anything missing/broken please provide feeedback via github issues.

Can one setup Spring Boot 2.6 and Spring Cloud 2021.x to use Ribbon and Hystrix with Spring WebClient and Feign?

I know that Spring Cloud at some version (3.0?) dropped direct support for some Netflix libraries like Ribbon or Hystrix. Now I'm trying to make a smooth migration of around 20 microservices running on production having some custom code extending Ribbon (and Hystrix to a lesser degree). The main goal is to upgrade from Spring Boot 2.3 to 2.6. As a consequence I need to upgrade Spring Cloud to 3.1.x, right?
My guess was to proceed with 2-step upgrade to avoid a one big-step migration:
Upgrade to Spring Boot 2.6 and Spring Cloud 3.1 while still using Ribbon and Hystrix
Make a way through a jungle of an old code and getting rid of Ribbon and Hystrix in smaller increments.
However to achieve this I'm trying to use simultanously Spring Boot 2.6, Spring Cloud with release train 2021.01 and 2 selected starters from older Spring Cloud (latest versions of these artifacts):
spring-cloud-starter-netflix-hystrix 2.2.10.RELEASE
spring-cloud-starter-netflix-ribbon 2.2.10.RELEASE
Is this possible at all? We are heavilly using Feign and Spring WebClient - client-side load-balancing must work for these. So far I found out Feign clients are not automatically integrated with Ribbon.
#spencergibb #OlgaMaciaszek - especially counting on you.
Answering my own question after receiving confirmation from Spring Cloud team by other means: this is a bad idea to try use Ribbon with Spring Cloud 2021.01 and it would require a really hard work to make it working.
So short answer is: "no".

JPAMapStore missing in latest version of Hibernate-Spring

JPAMapStore missing in latest version of Hibernate-Spring.
Its Available in hazelcast-spring-3.2.4.jar, However i am not able to find it latest version of Hibernate-Spring.
I am trying to use JPA based Mapstore for my Spring Boot Application
It was deleted long time ago and moved to Hazelcast Code Samples. It's not strictly related to core Hazelcast, so you can write it on your own or just copy from the Code Samples.
Some other related resources:
Hazelcast JPA Code Sample
Hazelcast JPA Example
Hazelcast Spring Data Module

Configuring Spring Cloud Stream in Camden.SR5 with Spring boot 1.5.1

First off, thanks to the Spring team for all their work pushing this work forward!
Now that Camden.SR5 is official, I have some questions on how to correctly configure the spring cloud stream kafka binder when using Spring Boot 1.5.1.
Spring boot 1.5.1 has auto configuration for kafka and those configuration options seem to be redundant with those in the spring cloud stream kafka binder.
Do we use the core spring boot properties (spring.kafka.) or do we use (spring.cloud.stream.kafka.binder.)?
I did find this issue, but I am curious if this work will be included in the next Camden release?
https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/73
Additionally, I saw this issue reported on Stack Overflow and I believe it will also be an issue with Camden.SR5?
Failed to start bean 'inputBindingLifecycle' when using spring-boot:1.5.1 and spring-cloud-stream
Thanks
Supporting the Boot 1.5 configuration options is an issue in progress. Also, since dedicated 1.5 support is coming only with Spring Cloud Stream Chelsea release train (which is included in the Dalston release of Spring Cloud), it will be available only there.
Also, when using Spring Cloud Camden with Boot 1.5 you will need to override the Kafka dependencies as described in Failed to start bean 'inputBindingLifecycle' when using spring-boot:1.5.1 and spring-cloud-stream. This will be avoided in future versions of Spring Cloud Stream (and Spring Cloud) but only starting in the Chelsea release train of Spring Cloud Stream (and the Dalston release of Spring Cloud) - see https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/88 for details.

Spring batch version 2.1.5 concurrent issue in BeanWrapperFieldSetMapper class

I am using Spring batch 2.1.5 as it is compatible with Spring 3.0.3 that we are using in our project. We are getting error while executing the batch job "Duplicate match with distance <= 5 found for this property in input keys" and this looks like a concurrency issue with class BeanWrapperFieldSetMapper. I check this thread "http://forum.spring.io/forum/spring-projects/batch/102370-duplicate-match-with-distance-5-found-for-this-property-in-input-keys" that says there is concurrency issue that has resolved in Spring batch 2.1.8.I have tested my code with Spring batch 2.1.8 and I am not getting the concurrency issue and data is persisted correctly. I can not use Spring batch 2.1.8 as it is internally using Spring 3.0.5 version and I don't wanted to have any class loading issue if I upgrade with 2.1.8.
Is there any workaround with Spring batch 2.1.5 to overcome the concurrency issue?
Thanks
Sach