[英]What's the easiest/proper way to wire Spring beans outside a webapp?
我正在開發一個非Web應用程序,我想在其中設置Spring。 我想擁有支持自動接線的最小配置。 正確的方法是什么? 我需要實現自己的ApplicationContext
加載機制,還是可以做得更好?
Spring提供了ApplicationContext
形式的IoC容器。 但是,您需要實現自己的機制來創建容器。 但這很簡單
public class Start {
public static void main(String[] args) {
ApplicationContext context = ...// whichever flavor you want
// maybe start some threads, possibly managed by the IoC container
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.