2

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.

Cornel Creanga
  • 5,311
  • 1
  • 22
  • 28
Kevin
  • 23,174
  • 26
  • 81
  • 111

4 Answers4

2

This is a very simple tutorial that outlines a basic setup (although using tomcat).

Edit: Another good example from a different question.

Community
  • 1
  • 1
sjohnston
  • 612
  • 5
  • 21
1

Ummm... "Hello world" programs typically demonstrate languages which Spring is not. What problem are you trying to solve?

David Soroko
  • 8,521
  • 2
  • 39
  • 51
1

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 3 hello world example

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

David Hackro
  • 3,652
  • 6
  • 41
  • 61
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – azurefrog Oct 13 '15 at 17:27
  • @azurefrog I've completed the answers,and i put tutorial official the spring – David Hackro Oct 13 '15 at 19:29
  • David, though you've expanded the description of each tutorial, there are still a number of issues with this answer. First, it would not help anybody solve the question ("hello world in spring") if the links went stale. Second, you have linked to six tutorials; clearly the vast majority of the linked content has nothing to do with implementing hello world. You should answer the question (describe how to make "hello world") here and only provide links to tutorials as reference. You can read more about link-only answers [here](http://meta.stackexchange.com/q/225370/253560). – josliber Oct 13 '15 at 22:04
  • @josilber sorry :D I've completed the answers ;) – David Hackro Oct 13 '15 at 23:47
0

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

Fazal
  • 2,991
  • 7
  • 29
  • 37