001package io.avaje.inject; 002 003import java.util.List; 004 005/** 006 * Deprecated - migrate to ApplicationScope. 007 * <p> 008 * Provides a global system wide BeanScope that contains all the beans. 009 * <p> 010 * This will automatically get all the beans and wire them all as necessary. It will use 011 * a shutdown hook to fire any <code>@PreDestroy</code> methods on beans. 012 * </p> 013 * 014 * <h3>Example: get a bean</h3> 015 * <pre>{@code 016 * 017 * CoffeeMaker coffeeMaker = ApplicationScope.get(CoffeeMaker.class); 018 * coffeeMaker.brew(); 019 * 020 * }</pre> 021 */ 022@Deprecated 023public class SystemContext { 024 025 private SystemContext() { 026 // hide 027 } 028 029 /** 030 * Deprecated - migrate to ApplicationScope.scope(). 031 */ 032 @Deprecated 033 public static BeanScope context() { 034 return ApplicationScope.scope(); 035 } 036 037 /** 038 * Deprecated - migrate to ApplicationScope.get(type). 039 */ 040 @Deprecated 041 public static <T> T getBean(Class<T> type) { 042 return ApplicationScope.get(type); 043 } 044 045 /** 046 * Deprecated - migrate to ApplicationScope.get(type, name). 047 */ 048 @Deprecated 049 public static <T> T getBean(Class<T> type, String name) { 050 return ApplicationScope.get(type, name); 051 } 052 053 /** 054 * Deprecated - migrate to ApplicationScope.listByAnnotation(annotation). 055 */ 056 @Deprecated 057 public static List<Object> getBeansWithAnnotation(Class<?> annotation) { 058 return ApplicationScope.listByAnnotation(annotation); 059 } 060 061 /** 062 * Deprecated - migrate to ApplicationScope.list(). 063 */ 064 @Deprecated 065 public static <T> List<T> getBeans(Class<T> interfaceType) { 066 return ApplicationScope.list(interfaceType); 067 } 068 069 /** 070 * Deprecated - migrate to ApplicationScope.listByPriority(). 071 */ 072 @Deprecated 073 public static <T> List<T> getBeansByPriority(Class<T> interfaceType) { 074 return ApplicationScope.listByPriority(interfaceType); 075 } 076 077}