Replaced shared editor usage with PropertyEditorRegistrar
This commit is contained in:
parent
532de1a259
commit
ddbcf62edd
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2002-2013 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy of
|
||||||
|
* the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations under
|
||||||
|
* the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.springframework.jmx.export;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.springframework.beans.PropertyEditorRegistrar;
|
||||||
|
import org.springframework.beans.PropertyEditorRegistry;
|
||||||
|
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Juergen Hoeller
|
||||||
|
*/
|
||||||
|
public class CustomDateEditorRegistrar implements PropertyEditorRegistrar {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerCustomEditors(PropertyEditorRegistry registry) {
|
||||||
|
registry.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("yyyy/MM/dd"), true));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,41 +4,20 @@
|
||||||
<beans>
|
<beans>
|
||||||
|
|
||||||
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
|
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
|
||||||
<property name="customEditors">
|
<property name="propertyEditorRegistrars">
|
||||||
<map>
|
<bean class="org.springframework.jmx.export.CustomDateEditorRegistrar"/>
|
||||||
<entry key="java.util.Date">
|
|
||||||
<bean class="org.springframework.beans.propertyeditors.CustomDateEditor">
|
|
||||||
<constructor-arg index="0">
|
|
||||||
<bean class="java.text.SimpleDateFormat">
|
|
||||||
<constructor-arg>
|
|
||||||
<value>yyyy/MM/dd</value>
|
|
||||||
</constructor-arg>
|
|
||||||
</bean>
|
|
||||||
</constructor-arg>
|
|
||||||
<constructor-arg index="1">
|
|
||||||
<value>true</value>
|
|
||||||
</constructor-arg>
|
|
||||||
</bean>
|
|
||||||
</entry>
|
|
||||||
</map>
|
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="dateRange" class="org.springframework.jmx.export.DateRange">
|
<bean id="dateRange" class="org.springframework.jmx.export.DateRange">
|
||||||
<property name="startDate">
|
<property name="startDate" value="2004/10/12"/>
|
||||||
<value>2004/10/12</value>
|
<property name="endDate" value="2004/11/13"/>
|
||||||
</property>
|
|
||||||
<property name="endDate">
|
|
||||||
<value>2004/11/13</value>
|
|
||||||
</property>
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean class="org.springframework.jmx.export.MBeanExporter">
|
<bean class="org.springframework.jmx.export.MBeanExporter">
|
||||||
<property name="beans">
|
<property name="beans">
|
||||||
<map>
|
<map>
|
||||||
<entry key="bean:name=dateRange">
|
<entry key="bean:name=dateRange" value-ref="dateRange"/>
|
||||||
<ref bean="dateRange"/>
|
|
||||||
</entry>
|
|
||||||
</map>
|
</map>
|
||||||
</property>
|
</property>
|
||||||
<property name="server" ref="server"/>
|
<property name="server" ref="server"/>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue