beehive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kenneth Tam <>
Subject Re: Control: annotation based injection
Date Tue, 16 Aug 2005 15:08:20 GMT
Hi Antony,

Can you provide some more detail on the scenario you're interested in?

You can think of controls as JavaBeans with a variable amount of
"container" provided functionality.  As such, using them can be as
simple as instantiating a JavaBean via existing JavaBean instantiation
mechanisms such as java.beans.Beans.instantiate or <jsp:useBean>.  The
controls model provides more "advanced" instantiation APIs in
org.apache.beehive.controls.api.bean.Controls (for example, this
allows explicit setting of initial properties and the container
context).  Any Java file/class can also participate in declarative
controls initialization, where you simply annotate a field whose type
is a control or a control interface with @Control -- when such a file
is processed with APT, a helper class is created with a single method
that knows how to inject all the controls in the original client.  One
of the first features that control containers typically provide is
support for automatically calling that helper; that's what allows e.g.
controls, pageflows and Beehive webservices to support
@Control-annotated fields seamlessly to the user.

The other major feature that control containers provide is context
management; not all controls need this, but features like control
lifecycle callbacks, external property override, etc, don't work
without it.  Beehive comes with a servlet filter that provides such
container services -- this means any webapp code can be
controls-enabled simply by adding a filter to web.xml.  See

hope this helps,

On 8/12/05, Antony Chien <> wrote:
> Hello everybody:
> I'm quite interested in the feature that beehive provides, especially the
> annotation based dependency injection.
> However, how do I make sure that this feature is available wherever I want?
> I mean, can I just take a POJO and add an annotation to call a Control? Is
> that possible?
> If not, then how do I prepare a right environment?
> --
> Regards,
> Antony Chien

View raw message