From 8774590593bef9f908d44f377b5e7ce577b7eeda Mon Sep 17 00:00:00 2001 From: Thomas Trageser Date: Mon, 25 Mar 2013 19:09:21 +0000 Subject: [PATCH] SPRNET-1544 Porblem with scanned objects and ObjectScope is Request or Session, LazyInit not set to true --- .../Attributes/ScannedGenericObjectDefinition.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Spring/Spring.Core/Context/Attributes/ScannedGenericObjectDefinition.cs b/src/Spring/Spring.Core/Context/Attributes/ScannedGenericObjectDefinition.cs index cdd5c80e..a988bca7 100644 --- a/src/Spring/Spring.Core/Context/Attributes/ScannedGenericObjectDefinition.cs +++ b/src/Spring/Spring.Core/Context/Attributes/ScannedGenericObjectDefinition.cs @@ -19,6 +19,9 @@ #endregion using System; + +using Common.Logging; + using Spring.Objects; using Spring.Objects.Factory.Support; using Spring.Objects.Factory.Xml; @@ -33,6 +36,8 @@ namespace Spring.Context.Attributes /// public class ScannedGenericObjectDefinition : GenericObjectDefinition { + private static readonly ILog Log = LogManager.GetCurrentClassLogger(); + /// /// Name provided by the Component Attribute /// @@ -51,9 +56,11 @@ namespace Spring.Context.Attributes ParseName(); ApplyDefaults(defaults); - ParseScopeAttribute(); ParseLazyAttribute(); + ParseScopeAttribute(); ParseQualifierAttribute(); + + Log.Debug(m => m("ComponentName: {0}; {1}", _componentName, ToString())); } private void ParseName() @@ -77,7 +84,14 @@ namespace Spring.Context.Attributes { var attr = Attribute.GetCustomAttribute(ObjectType, typeof(ScopeAttribute), true) as ScopeAttribute; if (attr != null) + { Scope = attr.ObjectScope.ToString().ToLower(); + + if (attr.ObjectScope == ObjectScope.Request || attr.ObjectScope == ObjectScope.Session) + { + IsLazyInit = true; + } + } } private void ParseLazyAttribute()