Java Code Examples for com.ruoyi.common.utils.spring.SpringUtils#getBean()

The following examples show how to use com.ruoyi.common.utils.spring.SpringUtils#getBean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DruidConfig.java    From RuoYi-Vue with MIT License 5 votes vote down vote up
/**
 * 设置数据源
 * 
 * @param targetDataSources 备选数据源集合
 * @param sourceName 数据源名称
 * @param beanName bean名称
 */
public void setDataSource(Map<Object, Object> targetDataSources, String sourceName, String beanName)
{
    try
    {
        DataSource dataSource = SpringUtils.getBean(beanName);
        targetDataSources.put(sourceName, dataSource);
    }
    catch (Exception e)
    {
    }
}
 
Example 2
Source File: ScheduleRunnable.java    From ruoyiplus with MIT License 5 votes vote down vote up
public ScheduleRunnable(String beanName, String methodName, String params)
        throws NoSuchMethodException, SecurityException
{
    this.target = SpringUtils.getBean(beanName);
    this.params = params;

    if (StringUtils.isNotEmpty(params))
    {
        this.method = target.getClass().getDeclaredMethod(methodName, String.class);
    }
    else
    {
        this.method = target.getClass().getDeclaredMethod(methodName);
    }
}
 
Example 3
Source File: MessageUtils.java    From supplierShop with MIT License 2 votes vote down vote up
/**
 * 根据消息键和参数 获取消息 委托给spring messageSource
 *
 * @param code 消息键
 * @param args 参数
 * @return 获取国际化翻译值
 */
public static String message(String code, Object... args)
{
    MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
    return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
}
 
Example 4
Source File: MessageUtils.java    From RuoYi-Vue with MIT License 2 votes vote down vote up
/**
 * 根据消息键和参数 获取消息 委托给spring messageSource
 *
 * @param code 消息键
 * @param args 参数
 * @return 获取国际化翻译值
 */
public static String message(String code, Object... args)
{
    MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
    return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
}
 
Example 5
Source File: MessageUtils.java    From ruoyiplus with MIT License 2 votes vote down vote up
/**
 * 根据消息键和参数 获取消息 委托给spring messageSource
 *
 * @param code 消息键
 * @param args 参数
 * @return
 */
public static String message(String code, Object... args)
{
    MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
    return messageSource.getMessage(code, args, null);
}