Enhanced Support For New Operator

In the 2018 release of ColdFusion, there is a handy way to create objects in ColdFusion.

The snippet below illustrates how you can use the new operator to create different type of objects.


//ColdFusion Component

obj = new component(“path.to.cfc”)



// Java

obj = new java(“java.class”)



// WebService

obj = new webservice(“http://webservice?wsdl”, {“webservice”: “parameters”})


Similarly, you can use the new operator to create com, CORBA, and .NET objects as well.

2 Responses

  1. Just to be clear, this syntax calls init for you:
    obj = new path.to.cfc();

    but this one doesn’t:
    obj = new component(“path.to.cfc”);

    What happened to the other syntax I saw during the prerelease– did this go away?

    new java:java.lang.String();

Leave a reply