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() . These examples are extracted from open source projects. 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 Project: RuoYi-Vue   File: DruidConfig.java    License: 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 Project: ruoyiplus   File: ScheduleRunnable.java    License: 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 Project: supplierShop   File: MessageUtils.java    License: 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 Project: RuoYi-Vue   File: MessageUtils.java    License: 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 Project: ruoyiplus   File: MessageUtils.java    License: 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);
}