Results 1 to 3 of 3

Thread: PropertyAccessExceptionsException and ref local Class

  1. #1
    Join Date
    Jul 2006
    Posts
    8

    Default PropertyAccessExceptionsException and ref local Class

    I'm hoping someone can shed some light on this for me. Why does the following throw a PropertyAccessExceptionsException:
    Code:
    <bean id="myJob" class="com.blahblah.myJob"></bean>
    
    <bean id="myJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
    	<property name="jobClass">
    		<ref local="myJob"/>
    	</property>
    </bean>
    and this doesn't (it works fine):
    Code:
    <bean id="myJob" class="com.blahblah.myJob"></bean>
    
    <bean id="myJobDetail" class="org.springframework.scheduling.quartz.JobDetailBean">
    	<property name="jobClass">
    		<value>com.blahblah.myJob</value>
    	</property>
    </bean>
    Is there a way to reference the myJob bean class? Here's the exception thrown from the former configuration:
    Code:
    Error setting property values; nested exception is org.springframework.beans.PropertyAccessExceptionsException:
    PropertyAccessExceptionsException (1 errors);
    nested propertyAccessExceptions are:
    [org.springframework.beans.TypeMismatchException:
    Failed to convert property value of type [com.blahblah.myJob] to
    required type [java.lang.Class] for property 'jobClass']
    What can I do to set the jobClass property to myJob's class? Is it even possible? Muchas gracias in advance!

  2. #2
    Join Date
    Jul 2006
    Posts
    8

    Default

    So, a little more research and I find that there is just no easy way to do this. Sorry Quartz, you failed the ease of implementation test. Back to timer.

  3. #3
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    You could use MethodInvokingFactoryBean to invoke the (inherited) getClass() method of the "myJob" bean. Have a look at the API documentation of MethodInvokingFactoryBean for details.

    Regards,
    Andreas

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •