Welcome to Dream.In.Code
Become a Java Expert!

Join 150,196 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,023 people online right now. Registration is fast and FREE... Join Now!




Want to start working with spring.....

 
Reply to this topicStart new topic

Want to start working with spring.....

junaidjee
14 Sep, 2008 - 03:26 AM
Post #1

New D.I.C Head
*

Joined: 6 Sep, 2007
Posts: 19


My Contributions
I have installed MyEclipse in my computer and now i want to start working with spring. From where can i start. I only know that spring is a framework and nothing more. What application does it supports? Which type application it builds?

I have heard that it has some relationship with java beans. I also dont know java beans, so how can i start working with spring.

Is there any settings i have to make in myEclipse to build spring application.
Please give me steps to print "Hello World!" using spring...
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Want To Start Working With Spring.....
14 Sep, 2008 - 08:22 AM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,660



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Well it appears you are just looking for information so here are two great sources that will show you Spring as well as a place to go for Spring specific questions and to get information on everything you want to know about Spring.

Springsource is the company that develops spring and the website below has tons of documentation, forums, tools etc for Spring...

Springframework.org - Tons of Spring related info

The important part to get you started is the introduction to the framework. Here is the link to an article that talks about it and gets you started understanding the idea behind the framework...

Enterprise Java Community: Introduction to the SpringFramework 2.5 - theserverside.com

That should get you moving in the right direction. smile.gif
User is offlineProfile CardPM
+Quote Post

JeroenFM
RE: Want To Start Working With Spring.....
14 Sep, 2008 - 11:29 AM
Post #3

D.I.C Head
Group Icon

Joined: 30 Jun, 2008
Posts: 191



Thanked: 9 times
Dream Kudos: 100
My Contributions
QUOTE(junaidjee @ 14 Sep, 2008 - 04:26 AM) *

Please give me steps to print "Hello World!" using spring...


Same as in ordinary Java:

java

public static void main(String[] args) {
System.out.println("Hello world!");
}


So, assuming you know what you want to use Spring for, which part of Spring are we talking about exactly? Inversion of Control?

java

class HelloWorld {
private HelloFactory bean;

public void setHelloFactory (HelloFactory bean) {
this.bean = bean;
}

public HelloWorld() {
}

public void doHello() {
System.out.println(bean.createHello());
}
}

class HelloFactory {
public HelloFactory() {
}

public String createHello() {
return "Hello world!";
}
}

class HelloProgram {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext(
new String[] {"hello.xml"});

// an ApplicationContext is also a BeanFactory (via inheritance)
BeanFactory factory = context;

HelloWorld hw = (HelloWorld) factory.getBean("hello");
hw.doHello();
}
}


xml

<?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/bean...5.xsd">
<bean name="hello" class="HelloWorld">
<property name="HelloFactory" ref="factory"/>
</bean>
<bean name="factory" class="HelloFactory">
</bean>
</beans>

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 04:38AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month