Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-6531

Need to add a 'required' field to the SpringResource annotation.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: spring
    • Labels:

      Description

      In my test environment, only the client is used(setForceServerMode(true)). Operating environments use clients and servers.
      Sometimes Injection is not required in the test environment.
      NoSuchBeanDefinitionException is not generated by specifying a value of false.

      public @interface SpringResource {

      /**

      • Declares whether the annotated dependency is required.
      • <p>Defaults to {@code true}

        .
        */
        boolean required() default true;
        ..

      if (!StringUtils.isEmpty(beanName)) {
      try

      { bean = springCtx.getBean(beanName); }

      catch(NoSuchBeanDefinitionException ne) {
      if(annotation.required())

      { throw ne; }
      }
      }
      else {
      try { bean = springCtx.getBean(beanCls); } catch(NoSuchBeanDefinitionException ne) {
      if(annotation.required()) { throw ne; }

      }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                skylark-nam joungdal.nam
                Reporter:
                skylark-nam joungdal.nam
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: