Issue Details (XML | Word | Printable)

Key: SPR-4487
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Juergen Hoeller
Reporter: Kenny MacLeod
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Spring Framework

@Autowired HttpSession is cached between sessions

Created: 21/Feb/08 09:23 AM   Updated: 25/Feb/08 08:26 AM
Component/s: SpringCORE
Affects Version/s: 2.5.1
Fix Version/s: 2.5.2

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive example.zip (2 kB)



 Description  « Hide
This seems like such an obvious problem, I feel like I'm doing something stupid.

I have a session-scoped bean in my web appcontext, and that bean declares an @Autowired HttpSession field. I would expect the current HttpSession object to be injected into the bean every time a new session-scoped instance is created. A simple test shows that the same HttpSession object is being injected into each instance of the bean.

This woul seem to be caused by the injectionMetadataCache incide AutowiredAnnotationBeanPostProcessor, unless I am very much mistaken.

To illustrate, I've attached some example files - a simple bean class, a servlet context definition, and a web.xml

What am I missing here? Is this really a bug?

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Juergen Hoeller added a comment - 24/Feb/08 04:02 PM
This is an unfortunate dependency caching problem that slipped into 2.5.1. I've fixed this for 2.5.2; will be available in tonight's snapshot. Thanks for raising this!

Juergen

Juergen Hoeller added a comment - 25/Feb/08 07:43 AM
If you get a chance to test the latest 2.5.2 snapshot in your scenario, let me know whether it works for you...

Juergen

Kenny MacLeod added a comment - 25/Feb/08 08:26 AM
I just tried the attached test case with the 20080224 snapshot, and it works fine now.

Thanks.