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

  • Home
  • SEARCH
  • 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 6690183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:36:24+00:00 2026-05-26T05:36:24+00:00

I have the following simple expression in my application-context.xml: <bean id=instrument class=com.ustunozgur.Instrument init-method=initialize scope=prototype>

  • 0

I have the following simple expression in my application-context.xml:

<bean id="instrument" class="com.ustunozgur.Instrument" init-method="initialize" scope="prototype">
<property name="age" value="#{4}"/>
<property name="name" value="Violin"/>

The Instrument class is a simple POJO. However, it is throwing the following error:

[ERROR] ...nested exception is org.springframework.beans.TypeMismatchException: 
Failed     to convert property value of type 'java.lang.String' to required type
'int'   for      property 'age'; nested exception is java.lang.NumberFormatException: For input string:
"{4}" -> 

Here is the initial beans declaration in my xml:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

What could be the problem? I have included spring-core, spring-expression, spring-context in my pom.xml. I am not doing any configuration via code; all the configuration is done via xml.

PS: This is a command line application, can it be the culprit?

PPS: The following code works though, so it seems only the spel in XML is ignored:

  ExpressionParser parser = new SpelExpressionParser();
  Expression exp = parser.parseExpression("'Hello World'");
  String message = (String) exp.getValue();

Here is my complete application-context.xml and pom.xml: http://paste.pocoo.org/show/494260/ and http://paste.pocoo.org/show/494262/

  • 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-26T05:36:25+00:00Added an answer on May 26, 2026 at 5:36 am

    Make sure you use ApplicationContext rather than BeanFactory. BeanFactory doesn’t support some advanced features of ApplicationContext, including Spring EL.

    See also:

    • 3.14.1 BeanFactory or ApplicationContext?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been playing around with Expression Trees. I have the following simple method that
I have the following very simple Javascript-compatible regular expression: <script type=text/javascript id=(.+) src=([^]+)> I
I have following simple class: @interface Article: NSObject { NSString *title; } @property (copy,
I have the following simple Java code: package testj; import java.util.*; public class Query<T>
I have the following JUnit test. The method that I'm testing is quite simple,
I have the following simple path. But everytime in Expression Blend I try and
We have the following simple Stored Procedure that runs as an overnight SQL server
I have the following simple button with an image as the template. The problem
I have the following simple function: private void EnableDisable941ScheduleBButton() { if (this._uosDepositorFrequency.Value != null)
I have the following simple python test script that uses Suds to call a

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.