package com.springexamples; public class Student { private int studentNo; private String studentName; public Student(int studentNo,String studentName){ this.studentNo = studentNo; this.studentName = studentName; } public int getStudentNo() { return studentNo; } public void setStudentNo(int studentNo) { this.studentNo = studentNo; } public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } }
package com.springexamples; public class StudentHandler { Student student; public StudentHandler(Student student){ this.student = student; } public void display(){ System.out.println("Student Details\n"); System.out.println(student.getStudentNo()); System.out.println(student.getStudentName()); } }
<?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-3.0.xsd"> <bean id="student" class="com.springexamples.Student"> <constructor-arg value="1001" /> <constructor-arg value="John" /> </bean> <bean id="studentHandler" class="com.springexamples.StudentHandler"> <constructor-arg ref="student" /> </bean> </beans>
package com.springexamples; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class RunMyProgram { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); StudentHandler studentHandler = (StudentHandler) context.getBean("studentHandler"); studentHandler.display(); } }
Do you want to delete a "" lesson. Warning! This delete will remove all it's sub lessons and contents.
Do you want to delete a "" sub lesson. Warning! This delete will remove all it's contents.
Do you want to delete content.
Do you want to remove selected book from favorite books.
Do you want to delete selected author from your authors list.