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 Mon, 30 Aug 2010 18:35:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CAYDOC&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAYDOC/Dependency+Injection+Container">Dependency
Injection Container</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~andrus">Andrus
Adamchik</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >* standard and user-defined scopes
for bound objects. <br> <br></td></tr>
            <tr><td class="diff-changed-lines" >h2. Examples of <span class="diff-changed-words">Customi<span
class="diff-added-chars"style="background-color: #dfd;">zi</span>ng</span>
Cayenne via DI <br></td></tr>
            <tr><td class="diff-unchanged" > <br>_TODO_ <br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <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" class="external-link" 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 DI container is used internally by the framework to wire its components,
and also allows users to easily extend and customize Cayenne. Cayenne DI does not attempt
to be "better than X or Y framework" or even be a general purpose DI framework. Still it has
no dependency on the rest of Cayenne and can theoretically be used as a standalone container
(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 the user's choice of a
DI framework (or a version of a DI framework). Using Cayenne DI will not create a conflict
with any third party DI container.</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 Injector instance</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-ExamplesofCustomizingCayenneviaDI"></a>Examples
of Customizing Cayenne via DI</h2>

<p><em>TODO</em></p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAYDOC/Dependency+Injection+Container">View
Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=8552558&revisedVersion=6&originalVersion=5">View
Changes</a>
                |
        <a href="https://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