Property Setting: Stream From URL : XML Bean Property « Spring « Java






Property Setting: Stream From URL

       
       
File: context.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
    "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
  <bean id="testBean" class="PropertyEditorTestBean">
    <property name="myInputStream" value="http://www.java2s.com"/>
  </bean>
</beans>


File: Main.java

import java.io.InputStream;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

public class Main {

  public static void main(String[] args) throws Exception {
    BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("context.xml"));
    PropertyEditorTestBean testBean = (PropertyEditorTestBean) beanFactory.getBean("testBean");

    System.out.println(testBean.getMyInputStream());
  }
}

class PropertyEditorTestBean {
  private InputStream myInputStream;

  public InputStream getMyInputStream() {
    return myInputStream;
  }

  public void setMyInputStream(InputStream myInputStream) {
    this.myInputStream = myInputStream;
  }
}



           
       








Spring-PropertySettingStreamFromURL.zip( 2,599 k)

Related examples in the same category

1.Property Setting: URL
2.PropertySetting: String Array
3.Property Setting: Properties
4.Property Setting: Integer
5.Property Setting: File
6.Property Setting: Class type
7.Property Setting: Byte Array
8.Property Setting: Boolean
9.Property Setting: BigDecimal
10.Properties Setting: Date
11.Load property File In Context
12.lazy init
13.Fill Value To List
14.Fill Map
15.Fill Set
16.Fill Properties
17.Fill List To Another List
18.Fill Calendar Object To List
19.Create List Map In Context
20.Bean Injection: Map
21.Bean Injection Collection: Set
22.Bean Injection: Collection Properties
23.Bean Injection Collection: Map
24.Bean Injection Collection: List