Thursday, 31 December 2015

XML : Ignore spring dependency injection : XML

  Project X  ---------  public class A {}    Public class B{      @Autowire      private A a;        @Autowire      private D d;  }      Project Y  ---------  Public class C{      public static void main(String[] args) throws Exception {          ApplicationContext context = new ClassPathXmlApplicationContext("spring/application-Context.xml");          B b = context.getBean("b", B.class);      }  }    application-Context.xml  <bean id="a" class="A" />  <bean id="b" class="B" />    

Question: I have setup like above, where I have binary of Project X, and currently I am working on Project Y. I want to create Class B object without creating D in Project Y. What is the best way to do it?

No comments:

Post a Comment