本文介绍了在application.cfc中创建FW/1服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在application.cfc中创建呼叫服务

I am trying to create call a service in application.cfc

原始代码如下

现在是

void function setupApplication() {

  ...
  application.objCCFRO  = new model.services.setting();
  application.stSetting = application.objCCFRO.loadini("standard.ini");

我正在尝试将其转换为

  application.stSetting = variables.beanFactory.getBean( "settingService" ).loadIni("standard.ini");

文档说

我在运行setupApplication()

推荐答案

好吧,如果您将DI/1与FW/1一起使用,则可以在Application.cfc中设置accessors="true",然后定义property settingService;.前提是DI/1正在管理该CFC,这将通过variables.settingService使该服务可用.

Well, if you're using DI/1 with FW/1, you can set accessors="true" in your Application.cfc and then define property settingService;. This will make the service available, via variables.settingService, providing that DI/1 is managing that CFC.

您的示例调用将变为:application.stSetting = variables.settingService.loadIni("standard.ini");

Your example call could then become: application.stSetting = variables.settingService.loadIni("standard.ini");

这篇关于在application.cfc中创建FW/1服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 22:03