Package org.imageconverter.util
Class BeanUtil
java.lang.Object
org.imageconverter.util.BeanUtil
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware,- org.springframework.context.ApplicationContextAware
@Component
public class BeanUtil
extends Object
implements org.springframework.context.ApplicationContextAware
Utils to retrieves spring objects to non managed objects.
- Author:
- Fernando Romulo da Silva
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voiddefineContext(org.springframework.context.ApplicationContext newContext) Set the spring context to retrive objects.static <T> TgetBeanFrom(Class<T> beanClass) Get a bean from its type.static <T> org.springframework.beans.factory.ObjectProvider<T>getBeanProviderFrom(Class<T> beanClass) Get a bean provider (factory) from its type.static org.springframework.core.env.EnvironmentGet the context environmentstatic StringgetPropertyValue(String key) Get the property value.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) 
- 
Constructor Details- 
BeanUtilpublic BeanUtil()
 
- 
- 
Method Details- 
defineContextpublic static void defineContext(org.springframework.context.ApplicationContext newContext) Set the spring context to retrive objects.- Parameters:
- newContext- The new context
 
- 
getBeanFromGet a bean from its type.- Type Parameters:
- T- The type
- Parameters:
- beanClass- The class type
- Returns:
- A bean retrieved
 
- 
getBeanProviderFrompublic static <T> org.springframework.beans.factory.ObjectProvider<T> getBeanProviderFrom(Class<T> beanClass) Get a bean provider (factory) from its type.- Type Parameters:
- T- The type
- Parameters:
- beanClass- The class type
- Returns:
- A bean retrieved
 
- 
getEnvironmentpublic static org.springframework.core.env.Environment getEnvironment()Get the context environment- Returns:
- A Environmentobject
 
- 
getPropertyValueGet the property value.- Parameters:
- key- The property value
- Returns:
- The String value property
 
- 
setApplicationContextpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
- setApplicationContextin interface- org.springframework.context.ApplicationContextAware
 
 
-