bean archives in Java EE6

Jave EE6 comes with a new feature called CDI (Context Dependency Injection).This allows you to inject beans and various other J2EE resources in to your application.

For CDI to roll in into your application, there should be a way to tell that the container that you want to use this feature.This is done through beans.xml.

This beans.xml file must be placed  in either META-INF/beans.xml and WEB-INF/beans.xml directory of your application to get it work.This file can be simply a place holder file which tells the run time that this module has beans that need to be used for CDI.Apart from that this file allows you to declare your interceptors, decorators and alternatives that you want to use.

 So any archive that comes with a beans.xml is said to be bean archive and the container only looks into bean archives for beans to be used as a part of CDI .

For more information about bean archive refer this document and for  a good explanation about why you need beans.xml , look here

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

This is my personal blog.All the information here reflects my own thoughts and feelings and should not be taken as official information from Oracle.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today