Taffy 2.1: applicationStartEvent and beanFactory

63 views
Skip to first unread message

Frank Semrau

unread,
Jan 12, 2014, 12:03:27 AM1/12/14
to taffy...@googlegroups.com
Hi,

I 'm new to Taffy and did some example projects. So far so good, everything worked fine. Then I wanted to integrate my DI/1 sample application to Taffy, but failed to initialise the bean factory with applicationStartEvent (like mentioned in the docs). I fiddled a bit with some debug to file and it seems that the applicationStartEvent function is never called by the framework.

Here is my sample Application.cfc:
<cfcomponent 
extends="taffy.core.api"
output="false">

<cfset this.name = "Test" />
<cfset this.mappings["/di1"] = expandPath("./di1") />
<cfset this.mappings["/resources"] = expandPath("./resources") />
<cfset this.mappings["/taffy"] = expandPath("./taffy") />
<cfset this.mappings["/model"] = expandPath("./model/") />

<cfset variables.framework = {
reloadKey = "reload"
,reloadPassword = "true"
,reloadOnEveryRequest = false
,defaultRepresentationClass = "taffy.core.nativeJsonRepresentation"
,dashboardKey = "dashboard"
,disableDashboard = false
,unhandledPaths = "/flex2gateway"
,allowCrossDomain = false
,globalHeaders = structNew()
,debugKey = "debug"
,returnExceptionsAsJson = true
,exceptionLogAdapter = "taffy.bonus.LogToScreen"
,beanFactory = ""
} />

<cffunction name="applicationStartEvent">
<cfset application.beanFactory = createObject("component", "di1.ioc").init("/model", { singletonPattern = ".+(Service|Factory)$" }) />
<cfset variables.framework.beanFactory = application.beanFactory />
</cffunction>
</cfcomponent>

my sample folder structure:
Test
| Application.cfc
| index.cfm
| di1
| model
| resources
| taffy

When I try to access a service bean from the model folder inside a resource in the resources folder, an exception is raised, because the service could not found. It seems, that the bean factory was not assigned to the framework.

I also build an api (Taffy in subfolder of application) with a parent application to test the behavior, but it failed like the one without parent application. But the bean factory is working in the parent application!

What am I doing wrong?

Thanks for your help!

Btw, I'm using CF10.

Frank

Adam Tuttle

unread,
Jan 12, 2014, 1:46:26 PM1/12/14
to taffy...@googlegroups.com
Hi Frank,

As of Taffy 2.0, applicationStartEvent() and requestStartEvent() have been phased out in favor of the traditional use of onApplicationStart() and onRequestStart().

More info here:


Adam


--
You received this message because you are subscribed to the Google Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to taffy-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Frank Semrau

unread,
Jan 12, 2014, 3:33:46 PM1/12/14
to taffy...@googlegroups.com
Hi Adam,

thank you for the info. It was my fault, I ignored that part of the documentation, because I immediately started with version 2.1.
Now when I use onApplicationStart() instead of applicationStartEvent() everythings works like a charme.

Thank you for the excellent work on Taffy.

Frank

Adam Tuttle

unread,
Jan 13, 2014, 9:31:53 AM1/13/14
to taffy...@googlegroups.com
Glad to help!

Adam


--
Reply all
Reply to author
Forward
0 new messages