高级 XMPP 连接 - SASLAuthentication、socketFactory

Advance XMPP Connection - SASLAuthentication, socketFactory

我想创建安全的 XMPP 连接,我试过了

<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 {

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

    testCompile("junit:junit")
}

但是classo.s.i.xmpp.XmppConnectionFactoryBean没有找到。我是否需要包含任何其他依赖项。

由于文档的格式,该包被缩写了。实际 class 名字是

org.springframework.integration.xmpp.config.XmppConnectionFactoryBean

这是解释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.

如果您在键入 class 名称时使用 IDE 内容辅助(eclipse,IDEA),它将为您完成包。