简体   繁体   English

Spring Framework的第一步

[英]First steps in Spring Framework

I have downloaded Spring Framework and using SpringSource dm Server. 我已经下载了Spring Framework并使用了SpringSource dm Server。 I just need to write a simple Hello world using Spring Framework. 我只需要使用Spring Framework编写一个简单的Hello world。 I don't know about the configuration and where to write the JAVA code. 我不知道配置和在哪里编写JAVA代码。

I did a google, but could not find anything that can help me out. 我做了一个谷歌,但找不到任何可以帮助我的东西。

This is a very simple tutorial that outlines a basic setup (although using tomcat). 是一个非常简单的教程,概述了基本设置(尽管使用了tomcat)。

Edit: Another good example from a different question. 编辑: 另一个问题的另一个很好的例子。

Ummm... "Hello world" programs typically demonstrate languages which Spring is not. 嗯...“ Hello world”程序通常演示Spring不提供的语言。 What problem are you trying to solve? 您要解决什么问题?

It's easy! 这很容易! in 5 steps you can run the hello world using Spring 在5个步骤中,您可以使用Spring运行Hello World

1. Set up a Maven Project 1.设置一个Maven项目

2. Add Spring Dependency 2.添加Spring依赖

3. Create the Spring Bean Configuration File 3.创建Spring Bean配置文件

4. Create a Spring Bean 4.创建一个Spring Bean

5. Run the Maven Project 5.运行Maven项目

Create a Hello class under /src/main/java directory to test the project. 在/ src / main / java目录下创建一个Hello类以测试项目。

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. 右键单击Hello.java并将其作为Java应用程序运行。 The result is: 结果是:

Hello! Program Creek Readers
Hello! Spring

More details see this tutorial 更多详细信息,请参见教程

here others tutorials the Hello World with Spring 其他人在这里用Spring讲解Hello World

Spring 3 hello world example Spring 3 Hello World示例

Spring MVC hello world example Spring MVC你好世界示例

If you wish to learn more,you can see, this tutorials the MKYONG 如果您想了解更多信息,可以查看本教程MKYONG

In this series of tutorials, it's provides many step by step examples and explanations on using the Spring framework. 在本系列教程中,它提供了许多使用Spring框架的分步示例和说明。

Spring Core Core support for dependency injection, transaction management, web applications, data access, messaging, testing and more. Spring Core Core支持依赖项注入,事务管理,Web应用程序,数据访问,消息传递,测试等。

Spring MVC , a Java Model-View-Contraller (MVC) web framework, which builds on top of the Spring Inversion of control(IoC) framework. Spring MVC ,一个Java Model-View-Contraller(MVC)Web框架,它基于Spring Inversion of control(IoC)框架构建。

Spring Security , is a flexible and powerful authentication and access control framework to secure Spring-based Java web application. Spring Security是一个灵活而强大的身份验证和访问控制框架,用于保护基于Spring的Java Web应用程序。

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 Data Mongo DB是Spring Data项目的一部分,该项目旨在为新数据存储提供熟悉且一致的基于Spring的编程模型,同时保留特定于存储的功能。

Spring Batch , is an open source framework for batch processing – execution of a series of jobs. Spring Batch是一个用于批处理的开源框架–执行一系列作业。 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. Spring Batch提供用于读取/写入资源,事务管理,作业处理统计信息,作业重新启动和分区技术的类和API,以处理大量数据。

And here , Introduction to the Spring Framework 在这里 ,Spring框架简介

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). 掌握Spring Manning in Action书(如果您打算在春季工作,Google可能会推荐给您或值得购买)。 It will explain to you properly how to start 它将正确地向您说明如何开始

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM