-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Drop outdated BeanFactoryLocator / beanRefContext.xml mechanism [SPR-15154] #19720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
John Blum commented Hi Juergen Hoeller- In fact, the Spring Data GemFire (SDG) makes fairly extensive use of this facility to bridge the world of Spring config and GemFire's native The idea is to let users auto-wire GemFire objects (e.g. While Spring is generally moving away from XML config, and while I have made several efforts to move SDG in the same direction, GemFire on the other hand is still largely configured with XML (i.e. As a result, this has led a few Pivotal customers (e.g. CDI, Citi, etc) to utilize a combination of both Spring config and GemFire config (whether that be with a node specific Even in the more typical client/server scenarios, customers can use Nearly all GemFire configuration can be expressed in Spring config (using SDG) largely because GemFire exposes an API for it. However, there are a few places, such as the GemFire to Greenplum Connector (G2C), that cannot be configured using Spring yet. Part of the reason for this is that GemFire does not expose appropriate configuration extensions in their API. Long story short, robwinch caught this problem in the Spring Session build, which integrates with GemFire (as a Session Repository provider) via SDG. There will (possibly) be a few other Spring projects using SDG affected by this as well. The good new is... I think I have a solution to this (SDG) problem without having to propose re-introducing the Sometime ago (in SDG 1.4, actually), at the request of the Spring XD team at the time, I introduced the SpringContextBootstrappingInitializer along with the ability to lazy-wire GemFire objects declared in This was needed in UCs where GemFire bootstraps a Spring So, I think I can repurpose this Anyway, I just wanted to make you aware of this feature in SDG that was based on the Thanks for your time. |
Juergen Hoeller commented John Blum, I wasn't aware of that; thanks for raising it. From my perspective, There are simpler ways to achieve the same, in particular if it doesn't have to be as overly flexible as |
John Blum commented Thank you for the quick response Juergen Hoeller.
Sounds reasonable and kind of similar to how Costin originally implemented the GemfireBeanFactoryLocator. Additionally, as I mentioned, I introduced the SpringContextBootstrappingInitializer for the lazy-wiring, GemFire bootstrapping Spring UC, that keeps a static holder to a Anyway, I am currently trying to build on this and replace all uses of I will post back here if I have anymore related questions since others might have similar problems and would look for ways on how to replace their Thanks again. |
Michael Minella commented Sorry to be commenting on a resolved issue, but why was this never depricated and just dropped without any formal guidance as to what to do in it's place? For the record, Batch is using this as well to bootstrap the infrastructure required for JSR-352. |
Juergen Hoeller commented Michael Minella, commenting here is fine, this is not released yet after all: It's waiting for 5.0 M5 in February. The reason for Now, as of Spring Framework 5.0 with its EE 7 baseline, there is no supported EE environment left where the What lifecycle have you been using |
Michael Minella commented Juergen Hoeller, Thanks for the quick response. Let me explain the use case I'm using it for and maybe you can guide me down a better path (or at least help me see the path I should be on). Per JSR-352, the way jobs are launched is via the following code: JobOperator jobOperator = BatchRuntime.getJobOperator();
jobOperator.start("myJobName", null);
Currently, in the no-arg constructor for the BeanFactoryLocator beanFactoryLocactor = ContextSingletonBeanFactoryLocator.getInstance();
BeanFactoryReference ref = beanFactoryLocactor.useBeanFactory("baseContext");
baseContext = (ApplicationContext) ref.getFactory(); This code allows me to bootstrap a new base context if one hasn't been created and reference it if it has. That base context contains all of the shared batch infrastructure components ( Is the right way going forward for me to handle what the |
Michael Minella commented Juergen Hoeller, I wanted to give this a bump. I have downgraded the version of Spring Framework to 4.3.6 in Batch 4 because our build breaks without a solution to this. I'd like to get this addressed before my next milestone which I'm targeting for before DevNexus (in a couple weeks). Any insight you can provide is appreciated. Thanks in advance! |
John Blum commented Hi Michael Minella- Spring Data GemFire had similar problems, as I described above. In the end, my solution was to keep yet simplify as much of the existing behavior, based on the original
To see how I implemented this for Spring Data GemFire see the While this may or may not work for Spring Batch, hopefully it will give you some ideas. Cheers, |
I'm also facing similar issue while migrating to Spring 5.x. |
If anyone still needs this, here is how we reintroduced the locator mechanism into our code. |
I am still not able to upgrade from Spring 4 to Spring 5 because of this issue only. Please go through the issue #28140 . |
Obtenidas de Spring 4 porque en Spring 5 han sido eliminadas en la issue spring-projects/spring-framework/issues/19720. Estas clases son necesarias para poder obtener el contexto padre en el EAR. Antes de la liberación de la versión, se explorarán otras vías para evitar tener que hacerlo así, pero por el momento, parece la única forma viable de hacerlo.
Uh oh!
There was an error while loading. Please reload this page.
Juergen Hoeller opened SPR-15154 and commented
The
BeanFactoryLocator
facility and itsbeanRefContext.xml
-based default variant are outdated mechanisms for locating a statically sharedApplicationContext
, only really useful for old-school EAR deployment layouts prior to EJB 3.1. While it still makes sense for this to be available in the 4.3.x line with its EJB 3.0 support, let's get rid of the entire mechanism for Spring 5 with its EE 7 baseline.This means that existing users of
SpringBeanAutowiringInterceptor
on custom EJB classes need to migrate either away from EJB altogether, or to an EJB 3.1 + CDI layer with a CDI-Spring bridge, or to a custom interceptor variant which locates the SpringApplicationContext
from an application-specific holder, e.g. an EJB 3.1 Singleton Bean or a simple static variable in an application class.Issue Links:
The text was updated successfully, but these errors were encountered: