Hi, I have an DummyAction{

private List<Record> records;
}

which has the following converter

DummyAction-conversion.properties:
KeyProperty_records=id
Element_records=com.package.model.RecordImpl
CreateIfNull_records=true

When the value stack is being populated in the ParametersInterceptor
method setParameter() 


newStack.setParameter(name, value);

the list records is not populated correctly.
Looking for the problem I see that in the OgnlValueStack class an
exception is caught telling me that the Interface Record cannot be
instantiated.
The method is:

private void setValue(String expr, Object value, boolean
throwExceptionOnFailure, boolean evalExpression) {
        Map<String, Object> context = getContext();
        try {
            trySetValue(expr, value, throwExceptionOnFailure, context,
evalExpression);
        } catch (OgnlException e) {
            handleOgnlException(expr, value, throwExceptionOnFailure,
e);
        } catch (RuntimeException re) { //XW-281
            handleRuntimeException(expr, value, throwExceptionOnFailure,
re);
        } finally {
            cleanUpContext(context);
        }
    }

And the exception is:

Error creating bean with name 'com.package.model.Record':
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class [com.package.model.Record]: Specified
class is an interface - Class:
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
File: AbstractAutowireCapableBeanFactory.java
Method: instantiateBean
Line: 1037 -
org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java:1037:-1

Now I know I can't instantiate interfaces and changing the list type to:

private List records;

there is no exception and the list records has the correct values but,
in both ways my converter does not seen to be used (I'm testing this
using a breakpoint in XWorkConverter).

So my questions are:
1) Which is the proper way of using the conversion when declaring the
List type as an interface, List<Record>?
2) Why is my converter not being used in either situation of declaring
List and List<Record>?

This question is related to Miguel Almeida post if you want to check
additional context, but I think this information should be sufficient.

Thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to