Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8736137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:14:11+00:00 2026-06-13T10:14:11+00:00

I have a class which will have a list of commands that it must

  • 0

I have a class which will have a list of commands that it must execute one after another. Commands may be repeated and I don’t want to create a bean for each Command.

What I have in mind is something like:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="parent" class="Parent">
    <property name="commands">
        <list value-type="Command">
            <value>OneCommand</value>
            <value>OtherCommand</value>
            <value>OneCommand</value>
        </list>
    </property>
</bean>
</beans>

And for each value the constructor of the class is called and a new Command object added to the list.

Thing is that when I run a test with that xml file the following exception:

...

Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.fideliapos.middleoffice.provisioning.ProvisioningCommand] for property 'commands[0]': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at org.springframework.beans.TypeConverterDelegate.convertToTypedCollection(TypeConverterDelegate.java:520)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:173)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
... 42 more

What am I doing wrong? How can I get spring to call the constructor?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:14:12+00:00Added an answer on June 13, 2026 at 10:14 am

    You may create a class implementing PropertyEditorSupport so that Spring knows how to convert from a String to your custom domain object.

    Example:

    public class CommandPropertyEditor extends PropertyEditorSupport {
      public void setAsText(String text) {
        // create a command from the given text
        Command command = Command.createFromString(text);
        setValue(command);
      }
    }
    

    And then reference it for Spring:

    <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer">
      <property name="customEditors">
        <map>
          <entry key="Command" value="CommandPropertyEditor"/>
        </map>
      </property>
    </bean>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a class that will have one public method, which returns a value
Let's say I have a list in a class which will be used in
I have a class which will store a list of objects and will also
I have a class which will contain list of two dependent classes inside it.
I'm currently working on an oophp application. I have a site class which will
I have a static timer class which will be called by ANY webpage to
I have developed an utility class for spring which is a singleton which will
I have class which have one public method Start , one private method and
I have class World which manages creation of object... After creation it calls afterCreation
I have an ORM class called Person, which wraps around a person table: After

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.