First steps in Spring Framework

I downloaded Spring Framework and used SpringSource dm server. I just need to write a simple Hello world using Spring Framework. I don't know about configuration and where to write JAVA code.

I did google but couldn't find anything that could help me.

+2


a source to share


4 answers


This is a very simple tutorial that covers basic setup (albeit using tomcat).



Edit: Another good example from another question.

+2


a source


Ummm ... "Hello world" programs usually show languages ​​that Spring does not. What problem are you trying to solve?



+1


a source


It's easy! in 5 steps you can start hello world with Spring

1. Set up your Maven project

2. Add Spring Dependency

3. Create a Spring Bean configuration file

4. Create Spring Bean

5. Run the Maven project

Create a Hello class in the / src / main / java directory to test your 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. Result:

Hello! Program Creek Readers
Hello! Spring

      

See this tutorial for details

here's other Hello World tutorials with Spring

Spring 3 world greetings example

Spring MVC MVC Welcome Example

If you want to know more, you can see that in this MKYONG guide

In this series of tutorials, he provides many step-by-step examples and explanations of using the Spring framework.

Spring Core Core support for dependency injection, transaction management, web applications, data access, messaging, testing, etc.

Spring MVC , a Java Model-View-Contraller (MVC) web framework that builds on top of the Spring Inversion of Control (IoC) framework.

Spring Security is a flexible and powerful authentication and access control framework for securing a w7612-based Java web application.

Spring Data Mongo DB is part of the Spring Data project, which aims to provide a familiar and consistent Spring - based programming for new data stores while maintaining store-specific features and capabilities.

Spring Package is an open source framework for batch processing - performing a series of tasks. Spring Package provides classes and APIs for reading / writing resources, transaction management, job processing statistics, job reloading, and partitioning methods for processing large amounts of data.

And here , An Introduction to Spring Framework

+1


a source


Get the Spring Manning in Action book (Google can give you or buy it if you plan on working on Spring more). He will explain you how to start

0


a source







All Articles