Annoyance - warning when using Mina 2.x with Spring 3.x

Does anyone know a good way to get rid of this warning, in addition to increasing the log level? Keep in mind that everything on the server still works as expected, but this happens every time the server restarts.

osbfcCustomEditorConfigurer - 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 uses Apache Mina 2.0 and Spring 3.0.4, but a warning has been appearing since Spring 2.5 or so.

+3
source share
1 answer

I assume that you probably have something similar in the 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 stated in the warning, PropertyEditorinstance transfers are out of CustomEditorConfigurerdate. However, use PropertyEditorclass names instead .

Learn more about this at Javadoc forCustomEditorConfigurer .

A simple solution in your case is to use the class name as the value of the map entry instead of the instance 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>
+4
source

Source: https://habr.com/ru/post/1763517/


All Articles