I'm want to use RoboSpring as inversion of control inside my Android application. Application consists of Android library and separate project which overrides some resources from library. And there are a lot of other projects which use this library. So library is like a basement and projects role is to change logo, theme and so on, but not a logic of application. But now I need to change some logic inside one of the applications. So I decided to use RoboSpring.
I'm created inside library's src folder file applicationContext.xml with
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:annotation-config />
<bean id="myServiceUrl" class="java.net.URL">
<constructor-arg value="http://www.robospring.org" />
</bean>
<bean id="client" class="com.example.Client">
<constructor-arg ref="clientParser"/>
</bean>
<bean id="clientParser" class="com.example.Parser"/>
</beans>
As example I declared some beans and I need to change clientParser inside one of the projects.
Problem #1:
I can't even override file applicationContext.xml inside project because I'll get error: Error generating final archive: Found duplicate file for APK: applicationContext.xml
I should keep applicationContext.xml only inside project or inside library, but it's not good to copypaste this file in every project. I think it can be solved by using custom contextConfigLocation but not sure how.
Problem #2
Even if I succeded in overriding context.xml how could I override only part of beans, actually only one bean? Because I think files are not merging and I should override whole xml file.
Actually I'm new to inversion of control and maybe I'm chose not correct tool to solve my problem, so any help will be appreciated