Portlet, Spring, Service Layer injecting HttpSession
I've got a service layer which is managed by spring. Now at one point I need some informations from the httpsession. Is there a clean way to in开发者_开发技巧ject the httpsession directly into my servicelayer?
My portlets are not managed by spring - this point matters in my setup.
Bad idea.
The service layer shouldn't have to know anything about HTTP.
My advice is to pull the information out of the session, bind it to a (validated) object, and make that object a parameter for one of the method calls on your service's interface.
This is NOT the place for injection.
精彩评论