遇到同樣, 可否詳細舉例說明解決方案,是否問題出在InputStream 上?

解决方案 »

  1.   

    import java.io.*; 
     
    import org.springframework.beans.factory.xml.XmlBeanFactory; 
    import org.springframework.core.io.ClassPathResource;
    import com.jidea.spring.beans.HelloBean;public class SpringTest { 
        public static void main(String[] args) throws IOException {        ClassPathResource res = new ClassPathResource("bean.xml");
           XmlBeanFactory factory = new XmlBeanFactory(res);
            
            HelloBean hello = (HelloBean) factory.getBean("helloBean"); 
            System.out.println(hello.getHelloWord()); 
    System.out.println(hello.sayHelloToUser()); 
        } 
    }