2012-03-29 16 views
0

良い午後、私はapache-cxf v 2.5.2、春2.5.6および休止状態v v 3.2.1に基づいたプロジェクトを持っています。私はアノテーションを使用してユニットやオブジェクトをマークしていますが、戦争を展開する際には問題があります。 org.springframework.beans.factory.BeanCreationException: 'storeService'という名前のBeanを作成中にエラーが発生しました:コンストラクタ引数を設定しているときに 'storeService'への参照を解決できません。ネストされた例外はorg.springframework.beans.factory.BeanCurrentlyInCreationExceptionです: 'storeService'という名前のBeanを作成中にエラーが発生しました:リクエストされたBeanが現在作成中です:解決できないループ参照がありますか?BeanCurrentlyInCreationExceptionについての解決不可能な循環参照

このは、両方のファイルがweb.xmlの

これをに含まれています

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:jaxws="http://cxf.apache.org/jaxws" 
    xsi:schemaLocation=" 
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> 
    <import resource="classpath:META-INF/cxf/cxf.xml" /> 
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" /> 
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" /> 
     <!-- DECLARACION DE LOS ENDPOINTS DE LOS WEB SERVICES--> 
     <jaxws:endpoint 
     id="storeService" implementor="#storeService" 
     implementorClass="com.aironman.core.cxf.service.StoreServiceImpl" 
     address="/Store" /> 
</beans> 

beans.xmlのこれはapplicationContext.xmlをファイル

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:jee="http://www.springframework.org/schema/jee" 
    xmlns:tx="http://www.springframework.org/schema/tx" 
    xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd 
     http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd 
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
     "> 
    <context:component-scan base-package="com.aironman.core" /> 
    <tx:annotation-driven transaction-manager="txManager"/> 
    <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
     <property name="sessionFactory" ref="sessionFactory"/> 
    </bean> 
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
     <property name="location" value="classpath:hibernate.properties"/> 
    </bean> 
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> 
     <property name="driverClassName" value="${database.driverClassName}"/> 
     <property name="url" value="${database.url}"/> 
     <property name="username" value="sa"/> 
     <property name="password" value=""/> 
    </bean> 
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> 
     <property name="dataSource" ref="dataSource"/> 
     <property name="hibernateProperties"> 
      <value> 
       hibernate.dialect=${database.hibernate.dialect} 
       hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider 
       hibernate.show_sql=true 
       hibernate.use_sql_comments=true 
       hibernate.jdbc.batch_size=0 
       hibernate.hbm2ddl.auto=create-drop 
       hibernate.default_schema=${hibernate.default_schema} 
       hibernate.generate_statistics=true 
       hibernate.cache.use_structured_entries=true 
      </value> 
     </property> 
    <property name="annotatedClasses"> 
      <list> 
       <value>com.aironman.core.pojos.Usuario</value> 
       <value>com.aironman.core.pojos.Item</value> 
       <value>com.aironman.core.pojos.Persona</value> 
      </list> 
     </property> 
    </bean> 
</beans> 

です実装はenですDポイントのWebサービス、storeService:あなたが見ることができるように、このサービスは、基本的@RepositoryとしてマークされたDAOを使用していますservicioPersistenciaUsuariosと呼ばれる永続的なサービスを、inyectedた

package com.aironman.core.service; 
**@Service("servicioUsuarios") 
public class ServicioUsuariosImpl implements ServicioUsuarios** { 
    private static ConcurrentHashMap <String,Usuario>hashMapUsuarios = new ConcurrentHashMap <String,Usuario>() ; 
    private Log log = LogFactory.getLog(ServicioUsuariosImpl.class); 
    @Autowired 
    @Qualifier("servicioEncriptacion") 
    private ServicioEncriptacion     servicioEncriptacion; 
    @Autowired 
    @Qualifier("servicioPersistenciaUsuarios") 
    private ServicioPersistenciaUsuarios   servicioPersistenciaUsuarios; 
    public ServicioUsuariosImpl(){ 
     log.info("Constructor SIN tipo ServicioUsuariosImpl..."); 
     //TODO pendiente cargar el mapa con una llamada al servicioPersistencia 
    } 
    @PostConstruct 
    public void init() 
    { 
     log.info("init method on ServicioUsuariosImpl. Initializing hashMap..."); 
     //i need to call persistence layer to fill the hashMap   
    } 
    some methods, getters and setters 
} 

**@Service("storeService") 
@WebService(endpointInterface = "com.aironman.core.cxf.service.StoreService") 
public class StoreServiceImpl implements StoreService** { 

    private Log log = LogFactory.getLog(StoreServiceImpl.class); 
    @Autowired 
    @Qualifier("servicioUsuarios") 
    private ServicioUsuarios   servicioUsuarios; 
    @Autowired 
    @Qualifier("servicioItems") 
    private ServicioItems    servicioItems; 
    @Autowired 
    @Qualifier("servicioApuntes") 
    private ServicioApuntesContables servicioApuntesContables; 
    [B]public StoreServiceImpl()[/B]{ 
     log.info("CONSTRUCTOR SIN tipo StoreServiceImpl..."); 
    } 
some methods... getters and setters ... 
} 

これはServicioUsuariosImplファイルです。

これはServicioPersistenciaUsuariosImpl実装ファイルである:これはusuarioHibernateDao実装ファイルである

package com.aironman.core.service; 
**@Service("servicioPersistenciaUsuarios") 
public class ServicioPersistenciaUsuariosImpl implements ServicioPersistenciaUsuarios** { 
    @Autowired 
    @Qualifier("usuarioHibernateDao") 
    private UsuarioHibernateDao usuarioHibernateDao; 
    private Log log = LogFactory.getLog(ServicioPersistenciaUsuariosImpl.class); 
    public ServicioPersistenciaUsuariosImpl() 
    { 
     log.info("Constructor ServicioPersistenciaUsuariosImpl..."); 
    } 
    some methods, getters and setters 
} 

package com.aironman.core.hibernate; 
**@Repository 
public class UsuarioHibernateDao extends HibernateGenericDao<Usuario, String> implements UsuarioDao** 
{ 
      private Log log = LogFactory.getLog(UsuarioHibernateDao.class); 
     [B]@Autowired 
     public UsuarioHibernateDao(@Qualifier("sessionFactory") SessionFactory sessionFactory) [/B]{ 
      super(sessionFactory); 
     } 
     some methods...   
} 

ServicioUsuariosImplは別のdependencie、servicioEncriptacionを持っており、あなたが見ることができるように、これは実装です:

package com.aironman.core.service; 
@Service("servicioEncriptacion") 
public class ServicioEncriptacionImpl implements ServicioEncriptacion 
{ 
     private static final String algoritmo = "SHA-256"; 
     private Log log = LogFactory.getLog(ServicioEncriptacionImpl.class); 
     private static java.security.MessageDigest diggest ; 
     [B]public ServicioEncriptacionImpl()[/B] 
     {some code... 
     } 
     some methods... 
    } 

これはServicioItemsImpl実装ファイルであり、別の依存関係はStoreServiceImplに属します。

package com.aironman.core.service; 
**@Service("servicioItems") 
public class ServicioItemsImpl implements ServicioItems**{ 
    private static final ConcurrentHashMap 
      <String,com.aironman.core.pojos.Item> 
      //La pk es el isbn del item 
      hashMapItems = new ConcurrentHashMap<String,com.aironman.core.pojos.Item>() ; 
    private Log log = LogFactory.getLog(ServicioItemsImpl.class); 
    @Autowired 
    @Qualifier("servicioPersistenciaItems") 
    private ServicioPersistenciaItems servicioPersistenciaItems; 
    [B]public ServicioItemsImpl()[/B] 
    { 
     log.info("Constructor SIN TIPO ServicioItemsImpl");  
    } 
    [B]@PostConstruct 
    public void init()[/B] 
    { 
     log.info("init method on ServicioItemsImpl. Initializing hashMap..."); 
    } 
    some methods, getters and setters 
} 

これはservicioPersistenciaItems実装ファイルです:

package com.aironman.core.service; 

@Service("servicioPersistenciaItems") 
public class ServicioPersistenciaItemsImpl implements ServicioPersistenciaItems 
{ 
    @Autowired 
    @Qualifier("itemHibernateDao") 
    private ItemHibernateDao itemHibernateDao; 
    private Log log = LogFactory.getLog(ServicioPersistenciaItemsImpl.class);  
    [B]public ServicioPersistenciaItemsImpl()[/B] 
    { 
     log.info("Constructor SIN tipo ServicioPersistenciaItemsImpl..."); 
    } 
some methods, getters and setters... 
} 

と仕上げ、ServicioApuntesContablesImpl実装ファイル、春をインスタンス化しようとすると依存関係のない短期で

package com.aironman.core.service; 
[B]@Service("servicioApuntes") 
public class ServicioApuntesContablesImpl implements ServicioApuntesContables[/B]{ 

    private Log log = LogFactory.getLog(ServicioApuntesContablesImpl.class); 
    private static ConcurrentHashMap <ClaveApunteContable,ApunteContable> mapaApuntesContables 
         = new ConcurrentHashMap <ClaveApunteContable,ApunteContable>(); 

    //TODO al final tendre que persistir los apuntes contables, por ahora los mantendre en memoria... 
    [B]public ServicioApuntesContablesImpl()[/B] 
    {} 
    some methods 
} 

で、問題が起こっています私はtを持っているファイル、gettersとセッターのいずれかに型付きのコンストラクタがないので、エンドポイントの実装ファイルstoreServiceとそれを理解していない彼は右と上の任意の依存はお互いに使用されます。誰かが私を助けて何が起こっているのか説明できますか?私は読みやすさの問題のためにいくつかのコードを入れていないと私はeasyly誰かが見て必要がある場合、私に知らせて、リミットcaractersに達し、あなたに非常に多くの

PDに感謝します。

答えて

2

私はすでに私の問題を解決しました。 endpoints.xml内部...

IDで宣言された私のWSを提出し、私はすでにWSが@Serviceアノテーションでファイルの実装を宣言しているdは、その例外は、今の私には明らかです
関連する問題