I studied the Spring Integration snippet of the ULC code
community but with some questions:
What means:
 ... it is sufficient to declare the ULC application as a
prototype bean in the application context and inject its
dependencies. It will be discovered through its type
IApplication:

You can get beans from a Spring application context (or bean factory)
by type or by name.  The example below simply gets the IApplication
instance by it's bean name.

Very interesting is also your quick development solution !
You defined the ULC DefaultLauncher as a bean in the spring-xml
file !?
How do you start this launcher for running tests?

This should get you started.  Use the code below, just add a package
declaration, set the location of the Spring XML file, and the bean
name for the IApplication context.  A ULC application instance needs
to be created for each unique user session on the web tier, so make
sure you make it a "protoype" bean instead of the singleton by
default.

 <bean name="myApp" singleton="false" class="com.company.MyApp">
   <property name="userDao" ref="userDao"/>
   <property name="dumbDao" ref="dumbDao"/>
   <property name="otherInjection" ref="otherInjection"/>
 </bean>

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.ulcjava.base.application.IApplication;
import com.ulcjava.base.development.DevelopmentRunner;

/**
* Allows you to use Spring Framework dependency injection with a ULC
DevelopmentRunner.
* It creates a Spring bean factory, gets the ULC application from the
bean factory
* and delegates everything to it.
*/
public class SpringDevelopmentRunner implements IApplication {
        
   private static final String SPRING_XML = "com/company/spring.xml";
   private static final String SPRING_IAPPLICATION_BEAN = "myApp";

        private ClassPathXmlApplicationContext _springContext;
        private IApplication _delegate;

        public void start() {
                _springContext = new ClassPathXmlApplicationContext(SPRING_XML);
                _delegate = (IApplication) 
_springContext.getBean(SPRING_IAPPLICATION_BEAN);
                _delegate.start();
        }

        public void stop() {
                _delegate.stop();
                _springContext.close();
        }

        public void activate() {
                _delegate.activate();
        }

        public void passivate() {
                _delegate.passivate();
        }

        public void handleMessage(String message) {
                _delegate.handleMessage(message);
        }
        
   public static void main(String[] args) {
       DevelopmentRunner.setApplicationClass(SpringDevelopmentRunner.class);
       DevelopmentRunner.main(args);
   }

}
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to