スプリングの初歩


1、spring      
	  spring  3.3.3  
	
       ,  ?
	*         ,  spring                  
	  spring           ,            

public class Trans extends PropertyEditorSupport {
	private String format;
	@Override
	public void setAsText(String arg0) throws IllegalArgumentException {
		SimpleDateFormat s=new SimpleDateFormat(format);
		try {
			Date d=s.parse(arg0);
			this.setValue(d);
		} catch (ParseException e) {
			
			e.printStackTrace();
		}
	}
	public void setFormat(String format) {
		this.format = format;
	}
}
	  
          ?
	*   PropertyEditorSupport ,  setAsText(),  :UtilDatePropertyEditor.java
	*          spring ,  :applicationContext-editor.xml
	
	<bean id="trans" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
		<property name="customEditors">
			<map>
				<entry key="java.util.Date" >
					<bean class="com.bjsxt.spring.Trans">
						<property name="format">
							<value>yyyy-MM-dd</value>
						</property>
					</bean>
				</entry>
			</map>
		</property>
	</bean>
		
---------------------------

	
       ,    :
	* ref  
	* <ref/>  
	*   <bean>   
	
          ?
	*   <bean>            ,   abstract="true"
	*            parent    
	  :applicationContext-other.xml		
 
Myeclipse
E:\192.168.0.150\11_Spring\spring-frame ework-2.0\dist\resoures\spring-tx-2..0.xsd http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
E:\192.168.0.150\11_Spring\spring-frame ework-2.0\dist\resoures\spring-beans-2.0.xsd http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
E:\192.168.0.150\11_Spring\spring-frame ework-2.0\dist\resoures\spring-aop-2.0.xsd http://www.springframework.org/schema/aop/spring-aop-2.0.xsd