Merge pull request #49 from ericklombardo/master
Resolved issue SPRNET-1547
This commit is contained in:
@@ -23,6 +23,7 @@ using System;
|
|||||||
using Common.Logging;
|
using Common.Logging;
|
||||||
|
|
||||||
using Spring.Objects;
|
using Spring.Objects;
|
||||||
|
using Spring.Objects.Factory.Config;
|
||||||
using Spring.Objects.Factory.Support;
|
using Spring.Objects.Factory.Support;
|
||||||
using Spring.Objects.Factory.Xml;
|
using Spring.Objects.Factory.Xml;
|
||||||
using Spring.Stereotype;
|
using Spring.Stereotype;
|
||||||
@@ -78,8 +79,21 @@ namespace Spring.Context.Attributes
|
|||||||
bool lazyInit = false;
|
bool lazyInit = false;
|
||||||
bool.TryParse(defaults.LazyInit, out lazyInit);
|
bool.TryParse(defaults.LazyInit, out lazyInit);
|
||||||
IsLazyInit = lazyInit;
|
IsLazyInit = lazyInit;
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(defaults.Autowire))
|
||||||
|
{
|
||||||
|
AutowireMode = GetAutowireMode(defaults.Autowire);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AutoWiringMode GetAutowireMode(string value)
|
||||||
|
{
|
||||||
|
AutoWiringMode autoWiringMode;
|
||||||
|
autoWiringMode = (AutoWiringMode)Enum.Parse(typeof(AutoWiringMode), value, true);
|
||||||
|
return autoWiringMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void ParseScopeAttribute()
|
private void ParseScopeAttribute()
|
||||||
{
|
{
|
||||||
var attr = Attribute.GetCustomAttribute(ObjectType, typeof(ScopeAttribute), true) as ScopeAttribute;
|
var attr = Attribute.GetCustomAttribute(ObjectType, typeof(ScopeAttribute), true) as ScopeAttribute;
|
||||||
|
|||||||
@@ -119,6 +119,15 @@ namespace Spring.Context.Config
|
|||||||
Assert.That(prototypeDef.IsLazyInit, Is.True);
|
Assert.That(prototypeDef.IsLazyInit, Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ComponentsUseDefaultAutoWire()
|
||||||
|
{
|
||||||
|
_applicationContext = new XmlApplicationContext(ReadOnlyXmlTestResource.GetFilePath("ConfigFiles.ComponentScan5.xml", GetType()));
|
||||||
|
var prototypeDef = _applicationContext.ObjectFactory.GetObjectDefinition("Prototype");
|
||||||
|
|
||||||
|
Assert.That(prototypeDef.AutowireMode == AutoWiringMode.ByName);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ComponentWithQualifier()
|
public void ComponentWithQualifier()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<objects xmlns="http://www.springframework.net"
|
<objects xmlns="http://www.springframework.net"
|
||||||
xmlns:context="http://www.springframework.net/context"
|
xmlns:context="http://www.springframework.net/context"
|
||||||
default-lazy-init="true">
|
default-lazy-init="true" default-autowire="byName">
|
||||||
|
|
||||||
<context:component-scan base-assemblies="Spring.Core.Tests">
|
<context:component-scan base-assemblies="Spring.Core.Tests">
|
||||||
<context:include-filter type="regex" expression="ComponentScan.ComponentsUseDefaults.*"/>
|
<context:include-filter type="regex" expression="ComponentScan.ComponentsUseDefaults.*"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user