Project

General

Profile

Bug #5303

override the muc module not effect

Added by 来恩 周 about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
Start date:
2017-04-11
Due date:
2017-04-19
% Done:

100%

Estimated time:
6.00 h
Database:
MongoDB
Applicable version:
7.2.0
Source Code Disclaimer:

Description

Hi, all

When I override the muc DiscoveryModule and configure it not effect?

My class is :


@Bean(name = DiscoveryModule3.ID, parent = MUCComponent.class, active = true)

public class DiscoveryModule3 extends tigase.component.modules.impl.DiscoveryModule {

.

.

.

}


init.properties configure is:


muc (class: tigase.muc.MUCComponent) {

admin (class: tigase.muc.modules.ModeratorModule3) {}

disco (class: tigase.muc.modules.DiscoveryModule3) {}

groupchat (class: tigase.muc.modules.GroupchatMessageModule3) {}

presences (class: tigase.muc.modules.PresenceModuleImpl3) {}

historyProviderPool (class: tigase.muc.history.HistoryProviderMDBean) {

    default (class: tigase.muc.history.HistoryProviderMDBean.HistoryProviderConfigBean) {
  1.      'data-source' = 'mongoDataSource'
    
        name = 'mucHistoryProvider' 
    
        'repo-class' = 'tigase.mongodb.muc.MongoHistoryProvider'
    
        instance (class: tigase.mongodb.muc.MongoHistoryProvider) {}
    
    }
    

    }

    'muc-dao' (class: tigase.muc.repository.MucDAOMDBean) {

    default (class: tigase.muc.repository.MucDAOMDBean.MucDAOProviderConfigBean) {
    
        instance (class: tigase.mongodb.muc.MongoMucDAO) {}
    
    }
    

    }

}

Associated revisions

Revision f2438a95 (diff)
Added by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

#5303: fixed issue with beans not being overriden by configuration if were registered in RegistrarBean::register(Kernel) or in AbstractKernelBasedComponent::registerModules(Kernel)

History

#1 Updated by 来恩 周 about 2 years ago

init.properties configure is:


muc (class: tigase.muc.MUCComponent) {

admin (class: tigase.muc.modules.ModeratorModule3) {}

disco (class: tigase.muc.modules.DiscoveryModule3) {}

groupchat (class: tigase.muc.modules.GroupchatMessageModule3) {}

presences (class: tigase.muc.modules.PresenceModuleImpl3) {}

historyProviderPool (class: tigase.muc.history.HistoryProviderMDBean) {

    default (class: tigase.muc.history.HistoryProviderMDBean.HistoryProviderConfigBean) {

        name = 'mucHistoryProvider' 

        'repo-class' = 'tigase.mongodb.muc.MongoHistoryProvider'

        instance (class: tigase.mongodb.muc.MongoHistoryProvider) {}

    }

}

'muc-dao' (class: tigase.muc.repository.MucDAOMDBean) {

    default (class: tigase.muc.repository.MucDAOMDBean.MucDAOProviderConfigBean) {

        instance (class: tigase.mongodb.muc.MongoMucDAO) {}

    }

}

}

#2 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

  • Status changed from New to Feedback
  • Assignee changed from Andrzej Wójcik to 来恩 周

It would be good to state build number of Tigase XMPP Server and explain exactly what is not working, ie. what errors do you get?

At first I would suggest you to remove @Bean annotation from your class. It is only needed for automatic registration of beans and it is not needed at all if you are specifying bean class in a config file.

Please attach etc/config.dump file with whole configuration dump which will contain information about registered beans (including beans from automatic registration). Moreover please check logs for any errors and warnings and attach them if there are any.

#3 Updated by 来恩 周 about 2 years ago

Sorry, I describe not enough detailed.

When I override the ModeratorModule named of ModeratorModule3, the ModeratorModule3 is copy from ModeratorModule.java file.

then I configure it at the init.properties file.

muc (class: tigase.muc.MUCComponent) {

admin (class: tigase.muc.modules.ModeratorModule3) {}

}

I start the XMPPServer, the muc component use ModeratorModule class still, not is ModeratorModule3 class.

but, if I delete this line 'kernel.registerBean(ModeratorModule.class).exec();' from MUCComponent.java file at 146 line, then muc component use ModeratorModule3 class. when I debug the code can jump into my ModeratorModule3 pocess method.

#4 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

  • Due date changed from 2017-04-12 to 2017-04-17
  • Assignee changed from 来恩 周 to Andrzej Wójcik

#5 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

  • Estimated time set to 6.00 h

#6 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam about 2 years ago

  • Due date changed from 2017-04-17 to 2017-04-19
  • Status changed from Feedback to In QA
  • Assignee changed from Andrzej Wójcik to 来恩 周
  • % Done changed from 0 to 100

I found that hardcoded modules (modules registered by registerModules() method) were being registered after configuration was applied, so they overwritten bean definition from a configuration file.

I changed execution order and now register() method (and as a result regusterModules() method) is called before configuration is applied. That way bean definition from configuration will be more important than hardcoded bean definition as it should be.

As a result of this change it is no longer possible to depend on bean configuration within register() and registerModules() methods, but it should not be done even before this change.

Next snapshot build of Tigase XMPP Server 7.2.0-SNAPSHOT will contain fix for this issue.

#7 Updated by 来恩 周 almost 2 years ago

ok,thank you for your help!

#8 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam almost 2 years ago

  • Status changed from In QA to Closed

Also available in: Atom PDF