Announcement Announcement Module
No announcement yet.
Roo 1.1.1 ApplicationConversionServiceFactoryBean possible bug Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Roo 1.1.1 ApplicationConversionServiceFactoryBean possible bug

    I have upgraded from roo 1.1.0 to roo 1.1.1 and I am using Spring mvc and have moved all my custom converters from the individual controllers to ApplicationConversionServiceFactoryBean. The custom converters were picked up in detail views but those remaining in the ApplicationConversionServiceFactoryBean_Roo_Conver sionService (default converters) were not being found and an unknown converter exception was thrown when any of these default converters were required.

    By removing all the custom converters from ApplicationConversionServiceFactoryBean and letting the default converters be created in ApplicationConversionServiceFactoryBean_Roo_Conver sionService every thing works fine or by moving all converters including the default converters to ApplicationConversionServiceFactoryBean.

    Having some converters in ApplicationConversionServiceFactoryBean and some in ApplicationConversionServiceFactoryBean_Roo_Conver sionService causes the ones in ApplicationConversionServiceFactoryBean_Roo_Conver sionService not to be found.

    Is this a bug or has anyone else seen such behaviour?

    As mentioned there is a solution to this but maybe it is not the desired one.

    Thanks in advance for any response.

  • #2
    Please post your ApplicationConversionServiceFactoryBean code. It sounds familiar but I have it working now. Just copying my old converters was not enough.


    • #3

      The code is below only one converter is shown but there are several others. I have also tried putting:

      registry.addConverter(getMobileOperatorConverter() );

      and all other custom converters below:

      // Register application converters and formatters

      I subsequently tried registering all the converters including those in ApplicationConversionServiceFactoryBean_Roo_Conver sionService below the commented line above but that did not work either.

       * A central place to register application Converters and Formatters.
      public class ApplicationConversionServiceFactoryBean extends
              FormattingConversionServiceFactoryBean {
          protected void installFormatters(FormatterRegistry registry) {
              // Register application converters and formatters
          Converter<MobileOperator, String> getMobileOperatorConverter() {
              return new Converter<MobileOperator, String>() {
                  public String convert(MobileOperator mobileOperator) {
                      return new StringBuilder().append(mobileOperator.getOperator())
                              .append(" ").append(mobileOperator.getBrand())
                              .append(" ")
      Thanks for quick response.


      • #4
        in ApplicationConversionServiceFactoryBean_Roo_Conver sionService
        PHP Code:
        public void ApplicationConversionServiceFactoryBean.afterPropertiesSet() {
        registers the default converters in installLabelConverters(). You can push the converters in or if you already have your own versions, ROO will remove them from the aspect but still handles the registration.

        If you have additional converters, register them like you did it.
        PHP Code:
        protected void installFormatters(FormatterRegistry registry) {
        // Register application converters and formatters


        • #5
          Set a breakpoint at the end in installLabelConverts() and inspect the registry. I can see, that my custom converters have been registered correctly.


          • #6

            I have the same code as you have. The problem is not with the custom converters but the default converters not being found if I have custom converters entered in ApplicationConversionServiceFactoryBean.

            Roo also insists on registering all the converters in method ApplicationConversionServiceFactoryBean.installLab elConverters in ApplicationConversionServiceFactoryBean_Roo_Conver sionService even when they have been registered in method installFormatters in ApplicationConversionServiceFactoryBean, maybe this is the problem, although when I turn off roo shell and comment out the custom converters from ApplicationConversionServiceFactoryBean.installLab elConverters in ApplicationConversionServiceFactoryBean_Roo_Conver sionService I still get converter not found for the default converters registered in ApplicationConversionServiceFactoryBean_Roo_Conver sionService.


            • #7
              Same problem using roo 1.1.2.

              I copied some Converters from ApplicationConversionServiceFactoryBean_Roo_Conver sionService to ApplicationConversionServiceFactoryBean and modified them to my needs.

              Now all converters from the generated Roo_ConversionService are ignored and not available to the application.
              Fixed it, by copying all Converters to the ApplicationConversionServiceFactoryBean.

              I will open an issue at jira.


              • #8

                I modified the ApplicationConversionServiceFactoryBean_Roo_Conver sionService and changed the convert method I want to be, then restart the server and the drop list show correctly