Search code examples
xmppspring-integrationsmack

Advance XMPP Connection - SASLAuthentication, socketFactory


I want to create XMPP connection with security, I tried this

<bean id="xmppConnection" class="o.s.i.xmpp.XmppConnectionFactoryBean">
    <constructor-arg>
        <bean class="org.jivesoftware.smack.ConnectionConfiguration">
            <constructor-arg value="myServiceName"/>
            <property name="truststorePath" value="..."/>
            <property name="socketFactory" ref="..."/>
        </bean>
    </constructor-arg>
</bean>

dependencies

dependencies {

    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.springframework.integration:spring-integration-xmpp:4.3.8.RELEASE")

    testCompile("junit:junit")
}

But class o.s.i.xmpp.XmppConnectionFactoryBean not found. Do I need to include any other dependency.


Solution

  • The package is abbreviated because of formatting for the documentation. The actual class name is

    org.springframework.integration.xmpp.config.XmppConnectionFactoryBean
    

    This is explained in the documentation.

    1. Conventions in this Book

    In some cases, to aid formatting, when specifying long fully-qualified class names, we shorten the package org.springframework to o.s and org.springframework.integration to o.s.i, such as with o.s.i.transaction.TransactionSynchronizationFactory.

    If you use IDE content assist (eclipse, IDEA) when typing class names, it will complete the package for you.