0 Replies Latest reply on May 4, 2011 12:25 PM by camilo casadiego

    El resolver problem

    camilo casadiego Newbie

      Hi guys...im finally managed to make mi spring-seam migration...now i have a weird problem...some of my beans needs information from some properties files, to manage this i build mi own seamResolver like this...


      public class PropertyELResolver extends SeamELResolver {
      
           private static ThreadLocal<String> recursionDetection = new ThreadLocal<String>();
      
           /**
            * @see org.jboss.seam.el.SeamELResolver#getValue(javax.el.ELContext,
            *      java.lang.Object, java.lang.Object)
            */
           @Override
           public Object getValue(final ELContext context, final Object base, final Object property) {
                Object value = super.getValue(context, base, property);
                // only search for matching properties if the call to super did not find
                // anything and if base is null
                // If base is not null then we are looking for a field on a bean so
                // theres no point checking properties for a
                // match
                if (value == null && base == null && property != null) {
                     if (recursionDetection.get() == null) {
                          recursionDetection.set(property.toString());
                          try {
                               value = getEnvironment().get(property.toString());
                               if (value != null) {
                                    context.setPropertyResolved(true);
                               }
                          } finally {
                               recursionDetection.set(null);
                          }
                     } else {
                          System.out.println("Oops check your config as you have some recursion problems");
                     }
                }
      
                return value;
           }
      
           /**
            * @return
            */
           private PropertyManager getEnvironment() {
                return (PropertyManager) Component.getInstance(PropertyManager.class, true);
           }
      }
      



      it works like a charm... when i load propeties like this


      @In("#{carpetaReportes}")
           private String carpetaReportes;
      



      bue when I try to inject something like this


      @In("#{novedadtemporal.tiponovedad}")
           private String tipoNovedad;
      



      im getting a null...this is because to the PropertyELResolver class is geting only 'novedadtemporal' instead of 'novedadtemporal.tiponovedad', so whe it trys to resolve it..it fails...the actual question..is why seam is only requestion for novedadtemporal instead of the full name???