Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"[object Object]" when using object properties in bean definition in XML #2086

Open
tplevko opened this issue Mar 13, 2025 · 3 comments · May be fixed by #2103
Open

"[object Object]" when using object properties in bean definition in XML #2086

tplevko opened this issue Mar 13, 2025 · 3 comments · May be fixed by #2103
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tplevko
Copy link
Contributor

tplevko commented Mar 13, 2025

Describe the Bug

When trying to specify route, with object properties in beans, the resulting XML route contains [object Object] instead of the object property.

Try to use route e.g.:

- route:
    id: test-route
    from:
      uri: timer:start?period=1000&delay=2000&repeatCount=10
      steps:
        - setBody:
            constant: Initial message
        - to:
            uri: log
            parameters:
              loggerName: test
- beans:
    - builderClass: test
      constructors:
        objectProperty: {}
      name: test
      properties:
        test: {}
      type: org.apache.camel.spi.ExchangeFormatter

The result XML route after the switch looks like this:

<camel>
  <route id="test-route">
    <from uri="timer:start?period=1000&amp;delay=2000&amp;repeatCount=10"/>
    <setBody>
      <constant/>
    </setBody>
    <to uri="log:test"/>
  </route>
  <beans>
    <bean name="test" type="org.apache.camel.spi.ExchangeFormatter" builderClass="test">
      <constructors>
        <constructor index="objectProperty" value="[object Object]"/>
      </constructors>
      <properties>
        <property key="test" value="[object Object]"/>
      </properties>
    </bean>
  </beans>
</camel>

Steps to Reproduce the Bug or Issue

  1. create a bean with object property
  2. switch to XML view
  3. see the [object Object] instead of the object property

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 0.30.0]
@tplevko tplevko added the bug Something isn't working label Mar 13, 2025
@lordrip
Copy link
Member

lordrip commented Mar 18, 2025

Before doing anything, let's check what's available in the beans constructor and properties.

There's also the possibility to use nested properties like the following:

properties:
  person.name: John
  person.lastname: Connor

@lordrip lordrip moved this from New to Backlog in Kanban Board Mar 18, 2025
@lordrip
Copy link
Member

lordrip commented Mar 18, 2025

It seems constructor only works with Map<String, String>

@mmelko mmelko self-assigned this Mar 19, 2025
@mmelko
Copy link
Contributor

mmelko commented Mar 19, 2025

@tplevko @lordrip for the properties I can convert object definitions to the inline format. @tplevko would that be sufficient ?

 person.name: John
 person.lastname: Connor

@mmelko mmelko added this to the 2.5.0 milestone Mar 19, 2025
mmelko added a commit to mmelko/kaoto-next that referenced this issue Mar 20, 2025
mmelko added a commit to mmelko/kaoto-next that referenced this issue Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Backlog
Development

Successfully merging a pull request may close this issue.

3 participants