I was wondering if there were any dependency injection frameworks for use with development on the iPhone. Being a Java developer by day, I enjoy, and see the benefits of, frameworks like Spring.
You can go part of the way by manually making certain components singletons and tying up the references manually.
...
interface IFoo<T> { }
interface IBar { }
class BarImpl : IBar { }
class FooImplA : IFoo<IBar> { }
class FooImplB : IFoo<BarImpl> { }
container.Register(
AllTypes.Of(typeof(IFoo<>)).From(assem)
.WithService.FirstInterface());
var bars = container.ResolveAll<IFoo<BarImpl>>();
Is there anyway to setup the Windsor contain...
Hello!
As I understand IoC-container is helpful in creation of application-level objects like services and factories. But domain-level objects should be created manually.
Spring's manual tells us: "Typically one does not configure fine-grained domain objects in the container, because it is usually the responsibility of DAOs and business...
I am working on a asp.net MVC application.
The app is structured as follows:
Web MVC
Services - Business Rules
Data
The data layer is using LinqToSql to query the sql database.
When the user logs into the application, based on the username, I can do a lookup to check which organisation they fall under. Depending on the organisatio...
With my pet project I'm trying to learn to use Turbine as a DI container.
I'm registering unity as locatorprovider as such:
static MvcApplication()
{
ServiceLocatorManager.SetLocatorProvider(() => new UnityServiceLocator());
}
My user repository has a parameterless constructor and I'm registering it as such:
public class UserRep...
Hi All,
How do you determine which classes should be constructed through an IOC container, and which ones shouldn't. I've worked on projects with both extremes and it seems like interfaces should only be used when the classs specifies a specific technoliogy like logging or data access?
Where do people draw the line between the two?
...
Hi,
I have the following setup:
@Component
public class ImplOne implements IFace{
}
@Component
public class ImplTwo implements IFace{
}
public interface IFace{
}
I am trying to get a reference of ImplOne by type:
@RunWith(SpringJUnit4ClassRunner.class)
public class ImplOneTest {
@Autowired
private ImplOne impl;
@Test
publ...
I certainly hope someone can help ease my frustration. I am trying to find a good way to unit test my WCF service implementation classes but every resource that I've found providing a solution is limited to services with only a single method/operation.
In my case, I have a service class which contains several service methods/operations...
Does anybody have experience with JSR 330 vs Guice? From what I gather Guice is not an implementation of JSR 330 but if it is anything like Hibernate and JPA the implementation supports a bunch of additional functionality no in the API. Since I am already using GWT-Dispatch, Warp-persist guice-serlvet, etc would there be anything gaine...
In wanting to get some hands-on experience of good OO design I've decided to try to apply separation of concerns on a legacy app.
I decided that I wasn't comfortable with these calls being scattered all over the code base.
ConfigurationManager.AppSettings["key"]
While I've already tackled this before by writing a helper class to enca...
I am trying to figure out how to use IoC in situations where the dependent classes can change based on some variable in the application (in this case, Session state). For example, each of our clients have a different database, so the connection to the database needs to be built on a value stored in their Session (particularly since some...
Pretty new to dependency injection and I'm trying to figure out if this is an anti pattern.
Let's say I have 3 assemblies:
Foo.Shared - this has all the interfaces
Foo.Users - references Foo.Shared
Foo.Payment - references Foo.Shared
Foo.Users needs an object that is built within Foo.Payment, and Foo.Payment also needs stuff from Foo...
Another developer and had this conversation today:
Me: Dependency Injection is cool, lol.
Dennis: What happens when I need an instance of the DoStuff class and the only constructor I have is DoStuff( ISomeInterface interface1, ISomeInterface interface2 ) where the concrete types are completely different?
Me: ...
We use Unity as our p...
I was wondering if it makes sense to have objects inherit from a class that implements the interface when dealing with dependency injections
example
public interface IPeople
{
string Name { get; set; }
int Age { get; set; }
string LastName { get; set; }
}
public class CPeople : IPeople
{..implemente...
I'd like to:
Make commonly required services visible to all classes that need them,
with a minimum of boilerplate, and
without sacrificing testability!
It's a small project and I think DI might be overkill, but maybe I'm wrong? Anyhow, I have been focusing on the ServiceLocator pattern as described by Martin Fowler
In a client clas...
I have application that look like below
without spring (prior)
UI-> service --> javabean
p.s: my ui call service (not using DI) and i want to remain this way
new service()
I want my javabean to do DI for certain bean from applicationcontext.xml file.
Should i use Applicationcontext.getBean(the ..xml) file in javabean or is th...
I have a Carpenter class that does it's work using a Lathe and a Wood object.
class Carpenter
{
function Work()
{
$tool = new Lathe();
$material = new Wood();
$tool->Apply($material);
}
}
Lathe depends on an interface called Material, so I can easily unit test Lathe by giving it a fake Material in my unit test. Wood doesn't d...
Following on from my question on service locators I have decided to use constructor injection instead. Please consider the following code:
<?php
interface IAppServiceRegistry {
public function getDb();
public function getLogger();
}
interface IFooServiceRegistry extends IAppServiceRegistry {
public...
Hi,
what is the advantage of using @configurable compared to on bean that not managed by bean doing di by applicationcontext.getbean? any anyone list pro and cons?
...
@Repository @Service @Controller
@Component
-->only use for spring managed bean (no need weaving)
-->@repository, @Service @controller is actually a @Component , just naming easier for programmer to understand
@Configurable
--->used for non spring managed bean (use with weaving)
@Autowired
--> use for DI for both cases abo...