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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:34:41+00:00 2026-05-22T17:34:41+00:00

I have a scenario where I need to inject values to the Arraylist in

  • 0

I have a scenario where I need to inject values to the Arraylist in a class that does not have the setter I believe in this scenario I need to do a get on the list in the POC class and then do a add:

public class POC {
  private  ArrayList<String> beheaviour=new ArrayList<String>();

  public ArrayList<String> getBeheaviour() {
    return beheaviour;
  }
}

Here is the xml mapping code :

<bean id="poc" class="outBoundocument.factory.POC">
  <property name="beheaviour">
    <list>
      <value>temp1</value>
      <value>temp2</value>
      <value>temp3</value>
      <value>temp4</value>
      <value>temp5</value>
    </list>
  </property>   
</bean>

the following code returns :

Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property ‘beheaviour’ of bean class [outBoundocument.factory.POC]: Bean property ‘beheaviour’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

I have no control over the POC class as its a external vendor provided class and I cant do a constructor injection to it as the only way to add values to it is in the following way :

POC poc=new POC();
poc.getBeheaviour().add("some Stuff")
  • 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-22T17:34:42+00:00Added an answer on May 22, 2026 at 5:34 pm

    As far as I know, Spring will not be able to help you here (if you do not have access to the code). Spring only allows you to work with closed-source classes as beans if you define it in XML, which in turn makes it impossible to do attribute injection.

    If you are not tied to Spring, you can do what you need with Java Reflection.


    UPDATE

    Apologies, it seems you can autowire via XML. Have a look here.

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

Sidebar

Related Questions

I have this scenario where I need data integrity in the physical database. For
I have a scenario where I need to update a list item, but I
I have helper component used in multiple classes. This is typical scenario: public class
I have the following scenario.I need to recommend artists to users. How should this
I have a scenario that I need to implement. Namely, my server needs to
This is a bit of weird scenario. I had a class that was quickly
I have this scenario: I need to know how to do in apache the
I have the following scenario: I need to figure out the unique list of
unihere's the scenario: I have a 1.8 million line text file that I need
I have a scenario where I need to upload a file from one web

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.