Announcement Announcement Module
Collapse
No announcement yet.
Spring IDE and JavaConfig Problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring IDE and JavaConfig Problem

    Hello,

    I'm using Spring Framework 2.5 RC1, Spring JavaConfig 1.0 M2 and Spring IDE 2.0.1 with JavaConfig Extention. I have the following problem ("No setters found for injected properties"):

    I have replaced a XML configuration with a @Configuration class and a XML configuration containing a bean definition for this @Configuration class and for ConfigurationPostProcessor.

    The @Configuration class looks something like this:

    Code:
    @Configuration
    public abstract class ModelConfiguration {
    
        @ExternalBean
        abstract SessionFactory sessionFactory();
        
        @Bean
        public OrderDao orderDao() {
            OrderDaoHbnImpl dao = new OrderDaoHbnImpl();
            dao.setSessionFactory(sessionFactory());
            return dao;
        }
    
        @Bean
        public ShoppingService shoppingService() {
            ShoppingServiceImpl service = new ShoppingServiceImpl();
            service.setOrderDao(orderDao());
            return service;
        }
        
    }
    Please be aware that the return type of the methods are the interfaces, not the concrete implementation classes.

    Now Spring IDE rises an error: " No setter found for property 'orderDao' in class 'orderentry.services.ShoppingService' "

    At runtime everything works fine. Any idea where the problem is? Do I have to adjust Spring IDE somehow?

    Regards in advance!

    Stefan.

  • #2
    Hi Stefan,

    can you please open a bug report for this in Spring IDE's JIRA? I'm not quite sure how to fix this now, but will think about it.

    Christian

    Comment


    • #3
      Hallo Christian,

      thanks for the quick feedback. I will ad a bug report as soon as possible.

      Stefan

      Comment


      • #4
        I just added a bug report: http://springide.org/jira/browse/IDE-737

        Stefan

        Comment


        • #5
          Thanks, Stefan.
          I will follow up in JIRA.

          Christian

          Comment


          • #6
            Hi.

            Are there any news about this?

            This bug is somewhat annoying...

            Thank you!

            Comment


            • #7
              (This post is not about this thread's subject)

              By the way, Stefan, just a suggestion: have you considered this approach for external beans? It uses the ConfigurationSupport.getBean(Class) method. I think it's better for refactoring; I suppose you'd have to rename the bean twice (in the original @Bean method and in the @ExternalBean method).

              Code:
              @Configuration
              public abstract class ModelConfiguration extends ConfigurationSupport {
                  
                  @Bean
                  public OrderDao orderDao() {
                      OrderDaoHbnImpl dao = new OrderDaoHbnImpl();
                      dao.setSessionFactory(getBean(SessionFactory.class));
                      return dao;
                  }
              
                  [...]
              }

              Comment


              • #8
                JavaConfig

                Hi,

                no, I haven't considered this. Thank you for that suggestion. But I'm not sure if this is "in the spirit" of JavaConfig...

                Regards
                Stefan

                Comment

                Working...
                X