Hi

How do you call that bean method - sendMailStandardAsync ?

Do you call it from another route or some java bean?

And is there more in the stacktrace? I wonder what that Map contains? I can
only assume spring do some proxy stuff and change the method parameters or
something.

If you can setup a sample project on github, then I can use that to debug.
Maybe we can detect this spring proxy stuff and unwrap the parameter from
the map and call the method with the right parameters.

On Thu, Jan 7, 2016 at 12:46 PM, Brendle, Detlef <
detlef.bren...@prospective.ch> wrote:

> PreAuthorize is a security annotation from Spring.
>
> org.springframework.security.access.prepost.PreAuthorize
>
> @Target({ ElementType.METHOD, ElementType.TYPE })
> @Retention(RetentionPolicy.RUNTIME)
> @Inherited
> @Documented
> public @interface PreAuthorize {
>    /**
>     * @return the Spring-EL expression to be evaluated before invoking the 
> protected
>     * method
>     */
>    String value();
> }
>
>
>
> 2016-01-07 12:42 GMT+01:00 Claus Ibsen <claus.ib...@gmail.com>:
>
>> Maybe the annotations creates some kind of proxy object that has a
>> method signature with a different type than the method itself.
>>
>> Where is that @PreAuthorize coming from?
>>
>> On Thu, Jan 7, 2016 at 12:38 PM, Brendle, Detlef
>> <detlef.bren...@prospective.ch> wrote:
>> > Hi all,
>> >
>> > I am facing an issue that I dont know how to solve.
>> > For Security Reasons I needed to secure a service method that is also
>> > called from a camel route.
>> >
>> > <route id="mail.standard.async">
>> >     <from uri="direct:sendMailStandardAsync"/>
>> >     <bean ref="mailService" method="prepareMailHeader"/>
>> >     <to uri="velocity://dummy"/>
>> >     <wireTap uri="direct:sendMailStandardSync"/>
>> >     <transform>
>> >         <constant>OK</constant>
>> >     </transform>
>> > </route>
>> >
>> >
>> >
>> > @PreAuthorize("hasRole('" + BerechtigungName.ROLE_USER + "')")
>> > public void sendMailStandardAsync(*MailInfo* mailInfo) {
>> >     LOG.info("Sending email to [{}]", mailInfo.getTo());
>> >     template.sendBody("direct:sendMailStandardAsync", mailInfo);
>> > }
>> >
>> > But now If the route is called I get an Exception:
>> >
>> > *No type converter available to convert from type:
>> > ch.prospective.njc.integration.mail.service.MailInfo to the required
>> > type: java.util.Map with value MailInfo*
>> >
>> >
>> > If I remove the Annotation again, everything works fine. So I assume
>> that
>> > somehow the annotation becomes part of the camel treatment.
>> >
>> > Does anybody know how to solve this issue ?
>> >
>> >
>> > Thanks,
>> > Detlef
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
>
>
> --
>
> Prospective Media Services
>
> Hofackerstrasse 32
>
> CH-8032 Zürich
>
>
>
> Phone  +41 44 384 55 19
>
> detlef.bren...@prospective.ch <i...@prospective.ch>
>
> www.prospective.ch
>
> blog.prospective.ch
>
>
> [image: Inline-Bild 1] <http://blog.prospective.ch/>  [image: Inline-Bild
> 8] <http://www.facebook.com/ProspectiveMedia>  [image: Inline-Bild 7]
> <https://plus.google.com/b/110350987305707874053/?tab=XX#110350987305707874053/posts>
> [image: Inline-Bild 5] <http://twitter.com/ProspectiveAG>  [image:
> Inline-Bild 3] <http://www.xing.com/companies/prospectivemediaservicesag>
> [image: Inline-Bild 4]
> <http://www.linkedin.com/company/prospective-media-services-ag>  [image:
> Inline-Bild 6]
> <http://www.kununu.com/ch/zh/zuerich/me/prospective-media-services>  [image:
> Inline-Bild 10] <http://www.youtube.com/prospectivemedia/>  [image:
> Inline-Bild 9] <http://www.flickr.com/photos/prospectivemedia/>  [image:
> Inline-Bild 2] <http://www.prospective.ch/news/rss/index.xml>
>
> PROSPECTIVE – FÜR UMFASSENDE RECRUITING-SOLUTIONS
>



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to