Skip to content
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

Support using Spring beans from EJB3 [SPR-4148] #8826

Closed
spring-projects-issues opened this issue Nov 21, 2007 · 3 comments
Closed

Support using Spring beans from EJB3 [SPR-4148] #8826

spring-projects-issues opened this issue Nov 21, 2007 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

Andreas Senft opened SPR-4148 and commented

I wondered about the best way on how to use Spring beans from within EJB3 beans. The support classes provided by Spring only cover 2.1 style EJBs.
So I came across this description: http://twasink.net/blog/archives/2007/01/using_spring_wi.html

Would it be possible to integrate something like this into Spring core?
Especially for cases where one is required to use EJBs but still want to leverage the simplicity of Spring-based POJOs this might be helpful.


Affects: 2.5 final

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Thanks for the suggestion, Andreas! I've introduced such an EJB3-compliant SpringBeanAutowiringInterceptor for processing Spring's @Autowired in EJB3 SBs/MDBs, living in the "org.springframework.ejb.interceptor" package. This is currently just tested against the JBoss EJB3 container, so feel free to give the next nightly 2.5.1 snapshot an early try!

Note that there are special rules for the bean factory locator key: If you have more than one shared ApplicationContext definition available in your EJB class loader, you need to override the "getBeanFactoryLocatorKey" method and provide a specific locator key for each autowired EJB. In case of one shared context only, this is the one to be picked automatically, with no need for custom overriding.

We could also provide an annotation for choosing the locator key at the bean type level, but I would argue there are more natural ways to achieve the same based on application-specific conventions. A custom "getBeanFactoryLocatorKey" implementation for a centrally specified SpringBeanAutowiringInterceptor could for example react to the target bean's package name, stereotype annotations, etc.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

FYI, I've also revised "jee:local-slsb" and "jee:remote-slsb" to work for EJB3 Session Beans as well, as alternative to using "jee:jndi-lookup" for such beans. This doesn't add much actual value beyond "jndi-lookup" for such beans but adds to the consistency of configuration, expressing a business interface, lazy lookup etc in the same style as for EJB 2.x beans.

This will also be available in tonight's 2.5.1 snapshot.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Kuno Baeriswyl commented

Hello Juergen,

I want to integrate Spring 2.5 with EJB 3.0 on JBoss 4.2.2. I haven't got it working yet. I've posted my problem to http://forum.springframework.org/showthread.php?t=49267

There is something wrong with classloading/inception, but I don't find out what it is. I also tried with beanRefDef.xml inside my ejb module - without success.

I'd be glad, if you could have a look to the post on the spring forum or, if possible, provide your sample application that you deployed on JBoss. Did you use the Spring Deployer?

Thanks a lot.

Kuno

@spring-projects-issues spring-projects-issues added type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 2.5.1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants