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>
|
||||
|
||||
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
|
||||
<property name="customEditors">
|
||||
<map>
|
||||
<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 name="propertyEditorRegistrars">
|
||||
<bean class="org.springframework.jmx.export.CustomDateEditorRegistrar"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="dateRange" class="org.springframework.jmx.export.DateRange">
|
||||
<property name="startDate">
|
||||
<value>2004/10/12</value>
|
||||
</property>
|
||||
<property name="endDate">
|
||||
<value>2004/11/13</value>
|
||||
</property>
|
||||
<property name="startDate" value="2004/10/12"/>
|
||||
<property name="endDate" value="2004/11/13"/>
|
||||
</bean>
|
||||
|
||||
<bean class="org.springframework.jmx.export.MBeanExporter">
|
||||
<property name="beans">
|
||||
<map>
|
||||
<entry key="bean:name=dateRange">
|
||||
<ref bean="dateRange"/>
|
||||
</entry>
|
||||
<entry key="bean:name=dateRange" value-ref="dateRange"/>
|
||||
</map>
|
||||
</property>
|
||||
<property name="server" ref="server"/>
|
||||
|
|
Loading…
Reference in New Issue