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

Document more Spring integration patterns for Bayeux services #54

Closed
sbordet opened this issue Dec 9, 2009 · 4 comments
Closed

Document more Spring integration patterns for Bayeux services #54

sbordet opened this issue Dec 9, 2009 · 4 comments

Comments

@sbordet
Copy link
Member

sbordet commented Dec 9, 2009

When using Spring along with other frameworks (such as, for example, Struts2), the strategy of overriding Spring's default loading mechanism may not work, because the framework may need to initialize Spring before the CometD servlet.

For example, Struts2 is configured via a servlet filter which cannot be configured using <load-on-startup> to be initialized after the CometD servlet. When Struts2 is integrated with Spring, initialization of the Struts2 filter triggers Spring initialization.

Document the pattern of using lazy initialization for Bayeux services.

@sbordet
Copy link
Member Author

sbordet commented Dec 9, 2009

Originally reported by sbordet on 2009-12-09T10:05:35Z

@sbordet
Copy link
Member Author

sbordet commented Dec 9, 2009

sbordet on 2009-12-09T10:59:17Z:
Documented 2 patterns: late initialization and lazy initialization, http://cometd.org/documentation/cometd-java/server/services/integration-spring.
The latter can be used with Struts2.

@sbordet
Copy link
Member Author

sbordet commented Dec 16, 2009

sritd on 2009-12-16T14:33:00Z:
Instead of adding the SpringBayeuxInitializer listener in the web xml for overriding the context loader, I was able to add the bayeux bean in the spring config like the following:

and was able to reference the bean using the lazy-init from one of my service classes.

This way I avoided adding the glue code and also let spring manage the service bean. If your service bean needs other resources, like dao, or other services, you might have to pass in as a constructor argument just like your pass in the bayeux bean.

Hope this helps. If you think that this may not solve my issue, please do comment.

Thanks,
Sridhar.

@sbordet
Copy link
Member Author

sbordet commented Dec 18, 2009

sbordet on 2009-12-18T09:37:01Z:
The above configuration strategy has been suggested by other sources as well on mailing lists and now here, so it has been added to the documentation as well as third pattern.

@sbordet sbordet closed this as completed Sep 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant