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 7446713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:23:28+00:00 2026-05-29T12:23:28+00:00

I have a simple class that has a property called executor in which I’d

  • 0

I have a simple class that has a property called “executor” in which I’d like to wire in an ExecutorService, with spring 3.0. I followed the documentation which states you simply use the factory class (in this case Executors) and supply factory-method to create your service. However, when I try to wire the resulting bean into my class, it seems that spring thinks the class type is java.lang.String instead of ExecutorService.

I have no idea what I’m doing wrong here. I seem to be correct if I look at the documentation, but perhaps I need to somehow indicate the resulting class of calling the factory method?

Here’s the error:

java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [java.util.concurrent.ExecutorService] for property ‘executor’: no matching editors or conversion strategy found

With this configuration:

<bean id="taskManager" class="examples.TaskManager">
    <property name="executor">
        <idref local="executorService" />
    </property>
</bean>
<bean id="executorService" class="java.util.concurrent.Executors" 
  factory-method="newSingleThreadExecutor" 
  destroy-method="shutdownNow" />

and this class:

public class TaskManager {

    private ExecutorService executor;

    public ExecutorService getExecutor() {
        return executor;
    }

    public void setExecutor(ExecutorService executor) {
        this.executor = executor;
    }   
}
  • 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-05-29T12:23:29+00:00Added an answer on May 29, 2026 at 12:23 pm

    Try simple ref attribute instead of idref:

    <bean id="taskManager" class="examples.TaskManager">
        <property name="executor" ref="executorService" />
    </bean>
    

    and see here that the meaning of idref is passing the referenced bean’s name (as a String) to the property.

    Oh, and here’s the Spring doc itself:

    The idref element

    The idref element is simply an error-proof way to pass the id (string
    value – not a reference) of another bean in the container to a
    or element.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have a very simple class that has a method called getThumbUrl() but
I have a very simple Person class that has a ivar called name (
I have a simple Java class that has some methods: public class Utils {
Let's say I have a very simple PrototypeJS class that looks like this: var
I have an Abstract class called Function which has 2 inheriting classes (actually 6,
I Have a controller that returns a viewModel. That viewModel has a property called
I have a rather simple user control (RatingControl) that has a dependency property defined
I have a simple class that essentially just holds some values. I have overridden
I have a simple class that contains some general information about the current web
I have a simple Class Hierarchy that I am trying to get to work

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.