Changeset 1769

Show
Ignore:
Timestamp:
10/14/08 15:58:36 (5 years ago)
Author:
lmajano
Message:

Basic autowire support via conventions for coldspring and lightwire

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • coldbox/trunk/system/plugins/ioc.cfc

    r1736 r1769  
    3535                        setpluginDescription("This is an inversion of control plugin."); 
    3636                         
    37                         /* Local Properties */ 
    38                          
    3937                        /* Setup the framework chosen in the config */ 
    4038                        setIOCFramework( getSetting("IOCFramework") ); 
     
    5957                                setLIGHTWIRE_FACTORY( getSetting("LightWireBeanFactory",true) ); 
    6058                        } 
    61                                                  
     59                         
    6260                        /* Return instance. */ 
    6361                        return this; 
     
    110108                <cfargument name="beanName" type="string" required="true" hint="The bean name to retrieve from the object factory"> 
    111109                <!--- ************************************************************* ---> 
    112                 <cfset var oBean = ""> 
     110                <cfset var oBean = 0> 
    113111                <cfset var beanKey = "ioc_" & arguments.beanName> 
    114112                <cfset var MetaData = structNew()> 
     
    119117                        <cfset oBean = getColdBoxOCM().get(beanKey)> 
    120118                <cfelse> 
    121                          
    122119                        <!--- Get Bean from IOC Framework ---> 
    123120                        <cfif lcase(getIOCFramework()) eq "coldspring"> 
     
    126123                                <cfset oBean = getIoCFactory().getBean(arguments.beanName)> 
    127124                        </cfif> 
     125                         
     126                        <!--- Autowire Support ---> 
     127                        <cfset getPlugin("beanFactory").autowire(target=oBean,annotationCheck=true)> 
    128128                         
    129129                        <!--- If Caching on, then set object in cache ---> 
     
    146146                                                <cfset MetaData.cacheLastAccessTimeout = ""> 
    147147                                        </cfif> 
    148                                          
     148                                        <!--- Cache the object ---> 
    149149                                        <cflock name="ioc.objectCaching.#arguments.beanName#" type="exclusive" timeout="30" throwontimeout="true"> 
    150                                                 <!--- Cache the object ---> 
    151150                                                <cfset getColdboxOCM().set(beanKey,oBean,metadata.cacheTimeout,metadata.cacheLastAccessTimeout)> 
    152151                                        </cflock> 
    153152                                </cfif> 
    154                         </cfif> 
    155                          
     153                        </cfif>                  
    156154                </cfif> 
    157155