Announcement Announcement Module
Collapse
No announcement yet.
Unable to Configure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to Configure

    Hi,

    I am preparing java spring. while developing spring application, i met a error.

    The code:
    import java.io.FileInputStream;

    import org.springframework.beans.factory.BeanFactory;
    import org.springframework.beans.factory.xml.XmlBeanFacto ry;
    import org.springframework.core.io.Resource;

    public class HelloApps {
    public static void main(String[] args) throws Exception {
    Resource r;
    BeanFactory factory = new XmlBeanFactory(new FileInputStream("greets.xml"));// Error Line:1
    GreetingService greetingService = (GreetingService) factory .getBean("greetingService");
    greetingService.sayGreeting();
    }
    }


    Errors:
    1: The constructor XmlBeanFactory(FileInputStream) is undefined

  • #2
    I suggest you start reading the reference guide and take a look at the sample applications. Also your exception is right, there is no constructor with that argument. You will need to construct a resource.

    I suggest using a ClassPathXmlApplicationContext instead.

    Comment

    Working...
    X