java spring simple application

Ads
 

java spring simple application

hai I have design a simple application in this I always found class not found exception. I am sendig code as follows please resolve this and send me.my directory structure is as follows

Project:Student/src/com.mazeed/StudentComponet.java/TestClient.java/springConfig.xml for this I have added lib files also

StudentComponent.java:

package com.mazeed;

public class StudentComponent {
    private String sname;
    public String getSname() {
        return sname;
    }
    public void setSname(String sname) {
        this.sname = sname;
    }
    public String getFname() {
        return fname;
    }
    public void setFname(String fname) {
        this.fname = fname;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    private String fname;
    private String city;
    public StudentComponent() {


    }

}

TestClient.java

package com.mazeed;
import org.springframework.beans.factory.*;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.*;

public class TestClient {
public static void main(String[] args)
{
    Resource res=new ClassPathResource("springConfig.xml");
    BeanFactory container=new XmlBeanFactory(res);
    System.out.println("container created");
    Object o=container.getBean("studbean");
    StudentComponent sc=(StudentComponent)o;
    System.out.println(sc.getCity());
    System.out.println(sc.getFname());
    System.out.println(sc.getSname());

}
}

Beans configuration:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

<bean id="studbean" class="StudentComponent" 
    abstract="false" lazy-init="default" autowire="default"
    dependency-check="default">
    <property name="sname">
    <value>mazeed</value></property>
     <property name="fname">
     <value>Raheem</value>
     </property>
  <property name="city">
  <value>Hyderabad</value>
  </property>
View Answers

June 2, 2011 at 12:33 PM

Please visit the following link:

Spring Tutorials


June 2, 2011 at 12:33 PM

Please visit the following link:

Spring Tutorials

Ads









Related Tutorials/Questions & Answers:
java spring simple application
java spring simple application  hai I have design a simple application in this I always found class not found exception. I am sendig code as follows.../beans/spring-beans-2.5.xsd"> <bean id="studbean" class="StudentComponent
Java Spring Desktop application
Java Spring Desktop application  Hi i am developing a desktop java spring application..It has many Jframes forms and classes...How to close one Jframe from another..Please tell... First jframe package desktopapplication2
Advertisements
Simple Java Desktop Upload application
Simple Java Desktop Upload application  I try do simple example for upload applicationtake file from c:\ put to d:\ :) PLEASE HELP
Hibernate Simple Program Using Java Application with Eclipse
Hibernate Simple Program Using Java Application with Eclipse  How to write Hibernate Simple Program Using Java Application with Eclipse? I wish to learn Hibernate using very popular Eclipse IDE. Share me the best tutorial link
Java Spring Desktop application with multiple classes and jframe
Java Spring Desktop application with multiple classes and jframe  Hi i am developing a desktop java spring application..It has many Jframes forms and classes...How to close one Jframe from another..Please tell... First jframe
Simple Spring Boot Example
Simple Spring Boot Example - First example of Spring Boot for counting no of beans Spring Boot Simple Example, writing and running the first example code.... In this tutorial we are going to create a very simple and first Spring Boot
Simple Spring Boot Example
Simple Spring Boot Example - First example of Spring Boot for counting no of beans Spring Boot Simple Example, writing and running the first example code.... In this tutorial we are going to create a very simple and first Spring Boot
Spring application in RSA 7.0.0.3
Spring application in RSA 7.0.0.3  how to build a sample spring application using RSA 7.0.0.3
Spring Boot Console Application
Spring Boot Tutorial- Spring Boot Console Application Welcome to the first example of Spring Boot, today we will teach you to create your first application...-based application that prints messages on console using the Spring Boot. We
Spring Boot Console Application
Spring Boot Tutorial- Spring Boot Console Application Welcome to the first example of Spring Boot, today we will teach you to create your first application...-based application that prints messages on console using the Spring Boot. We
Spring login form application
Spring login form application  Hi Please give me the Spring login form application so that i can understand its flow ?   Hi please find the link of the tutorial Spring Applications
Simple application using hibernate
Simple application using hibernate  Hi, How to write a simple application using hibernate in Eclipse IDE? I would like to to learn: Process... of the tutorial you will like to learn for creating the simple application using
How to add a bean in spring application?
How to add a bean in spring application?  Hi, How to add a bean in spring application? Thanks
Spring, Hibernate login and registration application
Spring, Hibernate login and registration application Spring, Hibernate login... fully function login and registration application in Spring and Hibernate... experience of Web application development Well versed with the Core Java
How a simple "Hello World" can be displayed using Spring 3.2 MVC?
How a simple "Hello World" can be displayed using Spring 3.2 MVC?  Hi, How a simple "Hello World" can be displayed using Spring 3.2 MVC? Thanks... application of framework based on Java Platform. For creating a small program of Hello
Java Spring
Java Spring  Hi, What is Java Spring? Thanks
Simple Calculator Application In Java Script
Simple Calculator Application In Java Script  ... the basics of JavaScript and create your first JavaScript program. What is simple Calculator The objective of this project is  learn how to write a simple
Java Spring Framework
is term used by developers for a Application development in Java, the Spring...Java Spring Framework  Hi, I have learned Core Java and Advanced Java. Now looking to learn more frameworks. What is Java Spring Framework
Java Spring Framework
is term used by developers for a Application development in Java, the Spring...Java Spring Framework  Hi, I have learned Core Java and Advanced Java. Now looking to learn more frameworks. What is Java Spring Framework
ClassNotFound Exception:DispatcherServlet in spring application?
ClassNotFound Exception:DispatcherServlet in spring application?  **I... environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.001\bin... org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring FrameworkServlet 'dispatcher
Java Application
Java Application  Hi, What is the applications of Java in development of software? What type of applications can be developed using Java programming Language? Can anyone tell me the url for downloading sample projects in Java
Java Client Application example
Java Client Application example  Java Client Application example
Java Client Application
Java Client Application  Java Client Application
simple bank application - JSP-Servlet
simple bank application  hi i got ur codings...But if we register a new user it is not updating in the database...so plz snd me the database also.... Thank you
Simple Bank Application in JSP
Simple Bank Application in JSP       In this section, we have developed a simple bank application in jsp . In this application user can Update the User Profile, Cash
Ask Spring Questions Online
;    Spring is an open source application Framework for Java platform and .NET Framework. The prime feature of Spring... of or with (Enterprise JavaBean) model. Spring Framework is widely used by Java
Java HTML Client Application
Java HTML Client Application  Java HTML Client Application
Batch file for java application
Batch file for java application  please tell me how to create the batch file for java application(using swings).the application is created with netbeans
Simple FTP upload in Java
Simple FTP upload in Java  How to write a program for Simple FTP upload in Java? Any code example of Simple FTP upload in Java will be very helpful for me. Thanks
Simple Java Projects
Simple Java Projects  Hi, I am beginner in Java and trying to find Simple Java Projects to learn the different concepts on Java. Can anyone tell me where to get it? Thanks
java reminder Application
java reminder Application  Create an awt application which imitates a reminder application,that stores notes and specify date and time to be reminded

Ads