This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB Resource Injection validation

 
Ramya Chowdary
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a EJB, there are couple of resources ( including strings) which should be injected.
But, While deploying,In the EJB configuration one can input wrong values for the resources which should be injected or forget to inject something ?

@postconstruct method will be called after the injection, but this method should not throw checked exceptions ( Honestly, don't know the reason, perhaps throwing throwing exception will make EJB deployment to stop, but that is what expected,Isn't it ?)

Is there a way to validate this, at least away to mention some resource as mandatory?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A runtime exception will stop your EJB from loading. A checked exception would be harder for the implementing container because they would have to deal with exceptions.
 
Ramya Chowdary
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, appreciate it
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic