You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/04/15 14:07:00 UTC
[jira] [Commented] (CAMEL-17971) camel-blueprint - Prototype scope doesn't work in bean
[ https://issues.apache.org/jira/browse/CAMEL-17971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17522844#comment-17522844 ]
Claus Ibsen commented on CAMEL-17971:
-------------------------------------
And you can also try setting ?scope=Prototype to the simple language as that should also be possible
<simple>${bean:uuidGenerator.toString}?scope=Prototype</simple>
> camel-blueprint - Prototype scope doesn't work in bean
> -------------------------------------------------------
>
> Key: CAMEL-17971
> URL: https://issues.apache.org/jira/browse/CAMEL-17971
> Project: Camel
> Issue Type: Bug
> Components: camel-blueprint
> Affects Versions: 3.14.2
> Environment: java 11, karaf 4.3.6
> Reporter: Valeria Borodina
> Assignee: Grzegorz Grzybek
> Priority: Minor
>
> I want to generate UUID. But uuidGenerator gets the same result every times.
>
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
> xsi:schemaLocation="
> http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
> ">
> <bean id="uuidGenerator" scope="prototype" class="java.util.UUID" factory-method="randomUUID"/>
> <camelContext id="example"
> xmlns="http://camel.apache.org/schema/blueprint">
> <route>
> <from uri="timer:foo?period=1000"/>
> <setHeader name="UUID">
> <simple>${bean:uuidGenerator.toString}</simple>
> </setHeader>
> <log message="UUID: ${headers.UUID}"/>
> </route>
> </camelContext>
> </blueprint> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)