Bryan,
There is no way this will work you the way you want it based on what I
see. Are you asking your bean factory for the SecurityService? From
the looks of this, you're creating the bean factory inside the security
service's init() method. ColdSpring cannot manage dependencies if it's
not the one that originally init'ed the service. When you ask CS for
the SecuritySerivce via getBean() it will auto-wire in the dependencies
that you defined in your ColdSpring xml file for you. Reactor is
another story -- I'm sure there are blog posts on using reactor and
coldspring's bean factory functionality.
How are you creating/getting the SecurityService (show code)? Are you
doing a createobject or are you asking CS for it via getBean()? To have
CS manage your dependencies, you need to ask CS for that object via
getBean().
.pjf
Bryan S said the following on 8/10/2007 12:30 PM:
Peter
My goal is to not have to pass the instantiateColdspriing at all and
have none of this code run. I want Coldspring to handle all of this
and have my getActiveDirectory method in the service to work. The
setActiveDirectory is working but for some reason the variable is
empty when I call the get.
Bryan
<cffunction name="init" returntype="any" output="false"
hint="Constructor">
<cfargument name="instantiateColdspriing" type="boolean"
required="false" default="false">
<cfif arguments.instantiateColdspriing>
<cfset variables.instance.BeanFactory =
createObject("component","coldspring.beans.DefaultXmlBeanFactory").init()
/>
<cfset
getBeanFactory().loadBeansFromXmlFile("/actionpacks/security/config/ColdSpring.xml",true)
/>
<cfset variables.instance.ActiveDirectoryDao =
getBeanFactory().getBean("ActiveDirectoryDao") />
<cfset variables.instance.Reactor =
getBeanFactory().getBean("Reactor") />
<cfset variables.instance.groupUserGateway =
getReactor().CreateGateway("GROUP_USER")>
<cfset variables.instance.groupOwnerGateway =
getReactor().CreateGateway("GROUP_OWNER")>
<cfset variables.instance.appRoleGateway =
getReactor().CreateGateway("APP_ROLE")>
<cfset variables.instance.appRoleGroupGateway =
getReactor().CreateGateway("APP_ROLE_GROUP")>
<cfset variables.instance.appMainGateway =
getReactor().CreateGateway("APP_MAIN")>
<cfset variables.instance.groupMainGateway =
getReactor().CreateGateway("GROUP_MAIN") />
<cfset variables.instance.pathMainGateway =
getReactor().CreateGateway("PATH_MAIN") />
</cfif>
<cfreturn this />
</cffunction>
On 8/9/07, *Peter J. Farrell* < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Bryan S said the following on 8/9/2007 10:38 AM:
I left out the most important part of the error message
Element INSTANCE.ACTIVEDIRECTORYDAO is undefined in VARIABLES
I posted a message earlier that hasn't posted yet. Can you post
the init() method form your securityService...
.Peter