| 137 | } |
| 138 | |
| 139 | Any ApplicationContext::ComponentHolder::create_instance( |
| 140 | ApplicationContext& context, const Any& option) noexcept { |
| 141 | auto instance = create_instance(); |
| 142 | if (instance) { |
| 143 | auto ret = autowire(instance, context); |
| 144 | if (ret != 0) { |
| 145 | BABYLON_LOG(WARNING) << "autowire failed for component of type " |
| 146 | << _type_id->type_id; |
| 147 | instance.clear(); |
| 148 | } else { |
| 149 | ret = initialize(instance, context, option); |
| 150 | if (ret != 0) { |
| 151 | BABYLON_LOG(WARNING) |
| 152 | << "initialize failed for component of type " << _type_id->type_id; |
| 153 | instance.clear(); |
| 154 | } |
| 155 | } |
| 156 | } else { |
| 157 | BABYLON_LOG(WARNING) << "create instance failed for component of type " |
| 158 | << _type_id->type_id; |
| 159 | } |
| 160 | return instance; |
| 161 | } |
| 162 | |
| 163 | void ApplicationContext::ComponentHolder::create_singleton( |
| 164 | ApplicationContext& context) noexcept { |