cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Cayenne Documentation > Dependency Injection Container
Date Sun, 29 Nov 2009 20:27:00 GMT
<html>
<head>
    <base href="http://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=CAYDOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="http://cwiki.apache.org/confluence/display/CAYDOC/Dependency+Injection+Container">Dependency
Injection Container</a></h2>
     <h4>Page <b>edited</b> by             <a href="http://cwiki.apache.org/confluence/display/~andrus">Andrus
Adamchik</a>
    </h4>
     
          <br/>
     <div class="notificationGreySide">
         <h2><a name="DependencyInjectionContainer-Introduction"></a>Introduction</h2>

<p>Since 3.1 Cayenne runtime bundles a simple dependency injection (DI) container. <a
href="http://en.wikipedia.org/wiki/Dependency_injection" rel="nofollow">Dependency injection</a>
(also known as "Inversion of Control") is a powerful approach of assembling application components
without creating tight coupling between them. There are a number of well-known dependency
injection frameworks, such as Spring and Guice. </p>

<p>Cayenne provides its own simple DI framework. It is used internally by the framework
to wire its components, and also allows users to easily extend and customize Cayenne. Cayenne
DI framework does not attempt to be "better than X or Y framework" or even a general purpose
framework, still it has no dependency on the rest of the Cayenne framework and can be used
as a standalone module at your own risk. </p>

<p>Cayenne DI framework provides annotation-based configuration API similar to Google
Guice and a subset of standard DI features needed by Cayenne. We decided not to use a third-party
framework for a number of reasons. Size - Cayenne DI container is about 30K. Guice and Spring
are at least 15 times larger (depending on what parts you want to include). Potential conflict
with DI frameworks used by applications - we don't want to dictate our user's choice of a
DI framework (and version of a DI framework). Cayenne DI will not create a conflict with any
third party DI.</p>

<h2><a name="DependencyInjectionContainer-FeaturesofCayenneDI"></a>Features
of Cayenne DI</h2>

<ul>
	<li>annotation-based field dependency injection</li>
	<li>annotation-based constructor dependency injection</li>
	<li>injection of map and list "configurations"</li>
	<li>binding interfaces to implementation classes via fluent API</li>
	<li>binding interfaces to "provider" (same as "factory") classes</li>
	<li>merging multiple DI "modules"</li>
	<li>dependency cycle detection</li>
	<li>standard and user-defined scopes for bound objects.</li>
</ul>


<h2><a name="DependencyInjectionContainer-ExamplesofCustomingCayenneviaDI"></a>Examples
of Customing Cayenne via DI</h2>

<p><em>TODO</em></p>
     </div>
     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="http://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>

       <a href="http://cwiki.apache.org/confluence/display/CAYDOC/Dependency+Injection+Container">View
Online</a>
       |
       <a href="http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=8552558&revisedVersion=2&originalVersion=1">View
Change</a>
              |
       <a href="http://cwiki.apache.org/confluence/display/CAYDOC/Dependency+Injection+Container?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message