0

I have 2 applications.

One is a swing application let's call it SWING_ONE, the other one is a JSE Spring enabled one with a Spring Context and it's used to communicate to webservices let's call is SPRING_ONE.

Now, I need SWING_ONE to start SPRING_ONE after it's done loading.

BUT !!! SPRING_ONE is added via maven profile at runtime... so no new appStart(); for me.

SWING_ONE has no Spring dependencies what so ever and cannot have them added.

I can mess around as much as I like with the SPRING_ONE.

this was being done by having SWING_ONE with this code

      String file = "jax-ws-embedded-context-" + Type + ".xml";
        AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
              new String[] {file});
        ctx.registerShutdownHook();

But Spring was banned from it because there was no need to have it there, but now I cannot think of a way to have SPRING_ONE...

I created a public void Main(String[args]) method inside the SPRING_ONE but without using reflections (I cannot use that too.) I cannot think of a way to start it or make it's ApplicationContext auto load.

Thanks;

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
Cristiano Fontes
  • 4,920
  • 6
  • 43
  • 76
  • possible duplicate of [ApplicationContextInitializer in a non-web Spring Context?](http://stackoverflow.com/questions/13288841/applicationcontextinitializer-in-a-non-web-spring-context) –  Feb 18 '13 at 17:53
  • If you do not know the name of your app at compile time, you will have to use reflection to retrieve it at runtime. FYI, Spring uses reflection all over the place to achieve its functionality, so the preevious solution of loading the Spring app context is effectively using reflection as well. I would say that your problem is overconstrained. There are some really horrible solutions, like autogenerating a .java file and then having Maven compile it, but I really think this is the sort of situation that reflection is intended for. – Eric Galluzzo Feb 18 '13 at 17:53
  • `Spring was banned from it because there was no need to have it there` - clearly there was... – pap Feb 19 '13 at 11:04
  • I thought so too... but I lost the voting. – Cristiano Fontes Feb 19 '13 at 12:23

0 Answers0