烦恼 - 将 Mina 2.x 与 Spring 3.x 一起使用时发出警告

发布于 2024-09-18 08:08:15 字数 475 浏览 10 评论 0原文

除了提高日志级别之外,有人知道摆脱此警告的好方法吗?请注意,服务器中的所有内容仍然按预期工作,但每次重新启动服务器时都会发生这种情况。

o.s.b.f.c.CustomEditorConfigurer - Passing PropertyEditor instances into CustomEditorConfigurer is deprecated: use PropertyEditorRegistrars or PropertyEditor class names instead. Offending key [java.net.SocketAddress; offending editor instance: org.apache.mina.integration.beans.InetSocketAddressEditor@314585

Red5 服务器使用 Apache Mina 2.0 和 Spring 3.0.4,但从 Spring 2.5 左右开始就出现了该警告。

Anyone know of a good way to get rid of this warning, besides increasing the log level? Mind you everything in the server still works as expected, but this occurs every time the server is restarted.

o.s.b.f.c.CustomEditorConfigurer - Passing PropertyEditor instances into CustomEditorConfigurer is deprecated: use PropertyEditorRegistrars or PropertyEditor class names instead. Offending key [java.net.SocketAddress; offending editor instance: org.apache.mina.integration.beans.InetSocketAddressEditor@314585

The Red5 server is using Apache Mina 2.0 and Spring 3.0.4, but the warning has been showing up since Spring 2.5 or so.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

冷清清 2024-09-25 08:08:15

我猜您在 Spring XML 文件中可能有类似的内容:

<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
    <property name="customEditors">
        <map>
            <entry key="java.net.SocketAddress">
                <bean class="org.apache.mina.integration.beans.InetSocketAddressEditor" />
            </entry>
        </map>
    </property>
</bean>

正如警告所述,不推荐将 PropertyEditor 实例传递到 CustomEditorConfigurer 中。不过,可以使用 PropertyEditor 类名来代替。

您可以在 CustomEditorConfigurer 的 Javadoc。

您的情况的简单修复方法是使用类名作为映射条目值,而不是 InetSocketAddressEditor 实例:

<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
    <property name="customEditors">
        <map>
            <entry key="java.net.SocketAddress" value="org.apache.mina.integration.beans.InetSocketAddressEditor" />
        </map>
    </property>
</bean>

I'm guessing you probably have something like this in a Spring XML file:

<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
    <property name="customEditors">
        <map>
            <entry key="java.net.SocketAddress">
                <bean class="org.apache.mina.integration.beans.InetSocketAddressEditor" />
            </entry>
        </map>
    </property>
</bean>

As the warning says, passing PropertyEditor instances into a CustomEditorConfigurer is deprecated. However it's OK to use PropertyEditor class names instead.

You can read more about this in the Javadoc for CustomEditorConfigurer.

The simple fix in your case is to use a class name as the map entry value, instead of an InetSocketAddressEditor instance:

<bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
    <property name="customEditors">
        <map>
            <entry key="java.net.SocketAddress" value="org.apache.mina.integration.beans.InetSocketAddressEditor" />
        </map>
    </property>
</bean>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文