AdobeStock_455007340

Application.cfc Inheritance

Home » Application.cfc Inheritance

Back when I first discussed the new Application event model exposed via Application.cfc, several users asked if inheritance would be supported. At the time I said no (at the time it wasn’t). But actually, inheritance did make it in.
For example, you could define an Application.cfc in the root of your application. Then, if you wanted to override the onError() method for a particular subdirectory you could create an Application.cfc in that subdirectory and have it inherit all of the methods in that first Application.cfc with the exception of onError which you’d override.
Technote Extend the ColdFusion MX 7 Application Framework using ColdFusion Components explains this in detail.

4 responses to “Application.cfc Inheritance”

  1. Sid Wing Avatar
    Sid Wing

    Ok, so I learn something new every day… Have never needed to imbed applications under other applications before… Now that I have and started hunting blogs… I find THIS entry with the technote link… THIS rocks!

  2. Sid Wing Avatar
    Sid Wing

    OK, so I deployed the test files from the TechNotes article… Primary index.cfm launches and behaves as expected… The Sales/index.cfm crashes miserably with "Could not find the ColdFusion Component BandwidthAssociates.Application." for an error… From all I have read and seen in other blogs, etc on the net, this should work… Running CFMX Enterprise 7.0.2… Any Ideas, Ben?

  3. Dan Davis Avatar
    Dan Davis

    Ben,
    I’m experiencing the same event as Sid Wing, no inheritnace of function definitions, particularly onRequestEnd() for me.

  4. dcolumbus Avatar
    dcolumbus

    I was previously using an Application.CFM for my site, but I want to switch to a .CFC … the problem is, my variables are UNDEFINED now. Is there a good resource that will show me how Application.CFC is supposed to be used? …and not just some dummy function… but actually being used. I can’t understand why my vars are all UNDEFINED!

Leave a Reply