Orm 通过Intershop7中的ObjectGraph绑定管理器

Orm 通过Intershop7中的ObjectGraph绑定管理器,orm,object-graph,intershop,Orm,Object Graph,Intershop,我们已经创建了一个自定义对象管理器,我们希望将其绑定到实现,以便我们可以将用于自定义对象处理的管理器注入到我们的盒式管道中 我们已经创建了Mgr接口和实现,并按照Intershop cookbook中的说明将实现绑定到接口: 这是objectgraph.properties的内容: global.modules = hr.a1.core.internal.modules.AppCoreA1NamingModule 这是AppCoreA1NamingModule.java的内容: /* *

我们已经创建了一个自定义对象管理器,我们希望将其绑定到实现,以便我们可以将用于自定义对象处理的管理器注入到我们的盒式管道中

我们已经创建了Mgr接口和实现,并按照Intershop cookbook中的说明将实现绑定到接口:

这是objectgraph.properties的内容:

global.modules = hr.a1.core.internal.modules.AppCoreA1NamingModule
这是AppCoreA1NamingModule.java的内容:

/*
 * AppCoreA1NamingModule AppCoreA1NamingModule.java.
 *
 * Copyright (c) 2018 OptimIT d.o.o.. All rights reserved.
 */
package hr.a1.core.internal.modules;

import javax.inject.Singleton;

import com.intershop.beehive.core.capi.naming.AbstractNamingModule;

import hr.a1.core.postpaid.capi.A1PostpaidPriceMgr;
import hr.a1.core.postpaid.internal.A1PostpaidPriceMgrImpl;

/**
 * The Class AppCoreA1NamingModule.
 */
public class AppCoreA1NamingModule extends AbstractNamingModule {

    /**
     * Configure.
     */
    @Override
    protected void configure() {

        bindManager(A1PostpaidPriceMgr.class).to(A1PostpaidPriceMgrImpl.class).in(Singleton.class);

    }

}
这是项目结构:

但是,当我们启动服务器或尝试使用管理器时,会出现以下异常:

1) No implementation for hr.a1.core.postpaid.capi.A1PostpaidPriceMgr was bound.
  while locating hr.a1.core.postpaid.capi.A1PostpaidPriceMgr
    for field at hr.a1.service.product.pipelet.ESBCreatePrices.a1PostpaidPriceMgr(ESBCreatePrices.java:34)
  while locating hr.a1.service.product.pipelet.ESBCreatePrices
build.gradle源代码:

apply plugin: 'java-cartridge'
apply plugin: 'static-cartridge'
apply plugin: 'com.intershop.gradle.cartridge-resourcelist'

intershop {
    displayName = 'Core - Core cartridge for A1 Organization'
    description = 'Core cartridge for A1 Organization'
}


dependencies {
   compile group: 'com.intershop.platform', name: 'bc_mail'
   compile group: 'com.intershop.platform', name: 'bc_service'
   compile group: 'com.intershop.platform', name: 'orm'
   compile group: 'com.intershop.business', name: 'bc_product'
   compile group: 'com.intershop.business', name: 'bc_image'   
   compile group: 'com.intershop.business', name: 'xcs'
   compile group: 'com.intershop.platform', name: 'cache'
   compile group: 'com.intershop.platform', name: 'core'
   compile group: 'com.intershop.platform', name: 'businessobject'
   compile group: 'com.intershop.platform', name: 'bc_repository'
   compile group: 'com.intershop.platform', name: 'bc_application'
   compile group: 'com.intershop.platform', name: 'pf_property'
   compile group: 'com.intershop.platform', name: 'app'

   compile ('com.intershop.platform:pf_axis2')
   {
       exclude module: 'axiom-api'
       exclude module: 'axiom-impl'
       exclude module: 'axis2-kernel'
       exclude module: 'axis2-transport-http'
       exclude module: 'axis2-transport-local'
       exclude module: 'geronimo-jta_1.1_spec'
       exclude module: 'servlet-api'
       exclude module: 'geronimo-activation_1.1_spec'
   }

   compile ('org.apache.axis2:axis2-kernel')
   {
       exclude module: 'axiom-api'
       exclude module: 'axiom-impl'
       exclude module: 'geronimo-activation_1.1_spec'
       exclude module: 'geronimo-jta_1.1_spec'
       exclude module: 'geronimo-ws-metadata_2.0_spec'
       exclude module: 'geronimo-stax-api_1.0_spec'
       exclude module: 'jsr311-api'
       exclude module: 'neethi'
       exclude module: 'servlet-api'
   }
   compile ('org.apache.axis2:axis2-transport-local')
   {
       exclude module: 'axis2-kernel'
       exclude module: 'axiom-api'
       exclude module: 'axiom-impl'
       exclude module: 'jsr311-api'
       exclude module: 'geronimo-jta_1.1_spec'
       exclude module: 'servlet-api'
       exclude module: 'geronimo-activation_1.1_spec'
   }
   compile ('org.apache.axis2:axis2-transport-http')
   {
       exclude module: 'axis2-kernel'
       exclude module: 'axiom-api'
       exclude module: 'axiom-impl'
       exclude module: 'jsr311-api'
       exclude module: 'geronimo-jta_1.1_spec'
       exclude module: 'servlet-api'
       exclude module: 'geronimo-activation_1.1_spec'
   }

   compile ('org.apache.ws.commons.axiom:axiom-api')
   {
       exclude module: 'geronimo-activation_1.1_spec'
       exclude module: 'geronimo-stax-api_1.0_spec'
       exclude module: 'jaxen'
       exclude module: 'stax-api'
   }

   compile ('org.apache.axis2:axis2-adb')
   {
       exclude module: 'axiom-dom'
       exclude module: 'axis2-kernel'
       exclude module: 'geronimo-ws-metadata_2.0_spec'
       exclude module: 'geronimo-activation_1.1_spec'
       exclude module: 'geronimo-stax-api_1.0_spec'
   }


      compile ('commons-logging:commons-logging')

      // https://mvnrepository.com/artifact/com.google.code.gson/gson
      compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'


}

我们还需要做些什么才能在墨盒中注入和使用manager?

我找到了一个解决方案。objectgraph.properties的路径应为src/main/resources/resources/[cartridgeName]/objectgraph/objectgraph.properties

更改路径后,manager将正确绑定。现在项目结构如下所示:


问题现在已经解决了,但在文件夹结构中有两个同名的文件夹确实令人困惑,因此可能应该从Intershop方面进行研究。

您可以将build.gradle文件添加到问题中吗?@willemeretse build.gradle添加到问题中。噢,哇,我从未猜到。同意intershop应该看看这个。至少要更新一下食谱。谢谢你的发帖。即使我现在会收到一场大便风暴,我想解释一下为什么这是必要的。在旧版本的Intershop中,盒带从未具有类似maven的源文件夹结构。所有内容都在一个java源文件夹中。这就是为什么需要额外的资源包前缀。无论如何,很抱歉给您添麻烦。我将向负责团队提交一个关于更新烹饪书文档的问题。