Representing deployment descriptor Metadata such as roles and constraints in
J2EE components as part of code is getting introduced in J2EE 5.0. But it is no different from your existing deployment descriptor. It is just a matter of convenience.
Some people call it as hard-coding !