[英]First steps in Spring Framework
我已經下載了Spring Framework並使用了SpringSource dm Server。 我只需要使用Spring Framework編寫一個簡單的Hello world。 我不知道配置和在哪里編寫JAVA代碼。
我做了一個谷歌,但找不到任何可以幫助我的東西。
嗯...“ Hello world”程序通常演示Spring不提供的語言。 您要解決什么問題?
這很容易! 在5個步驟中,您可以使用Spring運行Hello World
1.設置一個Maven項目
2.添加Spring依賴
3.創建Spring Bean配置文件
4.創建一個Spring Bean
5.運行Maven項目
在/ 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);
}}
右鍵單擊Hello.java並將其作為Java應用程序運行。 結果是:
Hello! Program Creek Readers
Hello! Spring
更多詳細信息,請參見本教程
其他人在這里用Spring講解Hello World
如果您想了解更多信息,可以查看本教程MKYONG
在本系列教程中,它提供了許多使用Spring框架的分步示例和說明。
Spring Core Core支持依賴項注入,事務管理,Web應用程序,數據訪問,消息傳遞,測試等。
Spring MVC ,一個Java Model-View-Contraller(MVC)Web框架,它基於Spring Inversion of control(IoC)框架構建。
Spring Security是一個靈活而強大的身份驗證和訪問控制框架,用於保護基於Spring的Java Web應用程序。
Spring Data Mongo DB是Spring Data項目的一部分,該項目旨在為新數據存儲提供熟悉且一致的基於Spring的編程模型,同時保留特定於存儲的功能。
Spring Batch是一個用於批處理的開源框架–執行一系列作業。 Spring Batch提供用於讀取/寫入資源,事務管理,作業處理統計信息,作業重新啟動和分區技術的類和API,以處理大量數據。
在這里 ,Spring框架簡介
掌握Spring Manning in Action書(如果您打算在春季工作,Google可能會推薦給您或值得購買)。 它將正確地向您說明如何開始
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.