• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Injection creates a new instance of stateless bean or reuse an instance?

 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p.430 of JSR 318

lookups of objects in the JNDI java: namespace are required to return a new instance of the requested object every time....
... a new instance of the requested object must be returned on each lookup.



But will the container inject a stateless bean that has been already existing in the bean pool instead of creating a new stateless bean?
If the container reuse a stateless bean and injects it , will the container violate the specification?
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found the discussion on Enthuware Forum :http://enthuware.com/forum/viewtopic.php?f=4&t=479

A stateless bean is shared. So, the container will not create a new instance of a stateless bean all the time upon a dependency injection.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic