3 comments

  1. Hi,
    It is almost the reason I started Spring-Annotation project (https://spring-annotation.dev.java.net/nonav/);
    Today night I`ll release the version 1.0.2 that will use the XML Schema option of spring 2.0 to enable the annotations reading (instead of another ApplicationContext implementation as the previous version).

    if you do not like the Spring-Annotation approach, you can at lease use the same same kind of XML Schema configuration to enable your annotation approach.

    look at one of the test cases:
    package net.java.dev.springannotation.annotation.beans;

    import net.java.dev.springannotation.annotation.Property;

    public class ParentBean {
    @Property(bean=”scopeTest”)
    private ScopeTestBean testProp;

    public ScopeTestBean getTestProp() {
    return testProp;
    }

    public void setTestProp(ScopeTestBean testProp) {
    this.testProp = testProp;
    }
    }

    import net.java.dev.springannotation.annotation.Bean;

    @Bean(name=”parentTest”)
    public class ParentPropertyBean extends ParentBean{
    }

    package net.java.dev.springannotation.annotation;

    import net.java.dev.springannotation.annotation.beans.ParentPropertyBean;
    import org.springframework.context.ApplicationContext;
    import org.springframework.context.support.ClassPathXmlApplicationContext;
    import junit.framework.TestCase;

    public class ParentPropertyTest extends TestCase {
    private ApplicationContext factory;

    protected void setUp() throws Exception {
    factory = new ClassPathXmlApplicationContext(“classpath*:testContext.xml”);
    }

    public void testParentProperty() {
    ParentPropertyBean bean = (ParentPropertyBean) factory.getBean(“parentTest”);
    assertNotNull(bean.getTestProp());
    }
    }
    – the XML configuration –



    I almost never use the @Property annotation, I prefer to just use the auto-wire approach …

    We have a lot of good code already written, the support for JSF is great and you have two more scopes already implemented for JSF applications (working in port it to Spring MVC).
    flash (from the end of one request to the start of the next one)
    and conversation (until a method with @ConvEnd is executed)

    please take a look and comment.

    Urubatan

  2. Urubutan, your solution looks a lot like what the Spring guys are doing, although your solution seems more mature. You should contact Rod and ask if you can join forces! It would be nice if there would be one solution for this kind of configuration with the best of both worlds.

    peterhe

  3. I have tried it before, they just do not like the idea of putting some of the configuration meta data within the business object …
    this is the main difference between my solution and their, in my solution the annotations goes directly in the business objects (very like the EJB3 approach) and in their it goes in a separate java file.

    But I`ll try again to join forces with them …

    Thanks …

    Urubatan

Comments are closed.