Пример #1
0
        /// <summary>
        /// Create the new bean by the specified key.
        /// </summary>
        /// <returns>The create.</returns>
        /// <param name="beanKey">Bean key.</param>
        private object Create(IDependencyInfo info, string beanKey)
        {
            object val = context.Autowire(info.Create());

            instances.Add(beanKey, val);

            val.GetType()
            .GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
            .ToList()
            .FindAll(x => x.Name.Equals(info.InitMethod) || x.GetCustomAttributes <PostConstructAttribute>().Any())
            .ForEach(x => InvokeInitMethod(x, val));

            return(val);
        }