Reputation: 23634
I have downloaded Spring Framework and using SpringSource dm Server. I just need to write a simple Hello world using Spring Framework. I don't know about the configuration and where to write the JAVA code.
I did a google, but could not find anything that can help me out.
Upvotes: 2
Views: 2066
Reputation: 3712
It's easy! in 5 steps you can run the hello world using Spring
1. Set up a Maven Project
2. Add Spring Dependency
3. Create the Spring Bean Configuration File
4. Create a Spring Bean
5. Run the Maven Project
Create a Hello class under /src/main/java directory to test the project.
public class Hello {
@SuppressWarnings("resource")
public static void main(String[] args) {
// loading the definitions from the given XML file
ApplicationContext context = new ClassPathXmlApplicationContext(
"applicationContext.xml");
HelloWorldService service = (HelloWorldService) context
.getBean("helloWorldService");
String message = service.sayHello();
System.out.println(message);
//set a new name
service.setName("Spring");
message = service.sayHello();
System.out.println(message);
}}
Right click Hello.java and run it as Java Application. The result is:
Hello! Program Creek Readers
Hello! Spring
More details see this tutorial
here others tutorials the Hello World with Spring
Spring MVC hello world example
If you wish to learn more,you can see, this tutorials the MKYONG
In this series of tutorials, it’s provides many step by step examples and explanations on using the Spring framework.
Spring Core Core support for dependency injection, transaction management, web applications, data access, messaging, testing and more.
Spring MVC , a Java Model-View-Contraller (MVC) web framework, which builds on top of the Spring Inversion of control(IoC) framework.
Spring Security, is a flexible and powerful authentication and access control framework to secure Spring-based Java web application.
Spring Data Mongo DB is part of the umbrella Spring Data project which aims to provide a familiar and consistent Spring-based programming model for for new datastores while retaining store-specific features and capabilities.
Spring Batch, is an open source framework for batch processing – execution of a series of jobs. Spring Batch provides classes and APIs to read/write resources, transaction management, job processing statistics, job restart and partitioning techniques to process high-volume of data.
And here, Introduction to the Spring Framework
Upvotes: 1
Reputation: 632
This is a very simple tutorial that outlines a basic setup (although using tomcat).
Edit: Another good example from a different question.
Upvotes: 2
Reputation: 3051
Get hold of Spring Manning in Action book (google may give it to you or its worth buying if you plan to work on spring more). It will explain to you properly how to start
Upvotes: 0
Reputation: 9086
Ummm... "Hello world" programs typically demonstrate languages which Spring is not. What problem are you trying to solve?
Upvotes: 1