+1. By the way, what kind of CDI scopes (e.g. ApplicationScoped, Dependent
etc) do you support? How do you map a particular scope to services
(prototype, singleton)? I would think the ApplicationScoped should map to
Singleton while Dependent to prototype. What about RequestScoped,
ConversationScoped, SessionScoped? Does the generation only scan for
@Inject, @Produces, @PostConstruct and bean scopes and ignore other
annotations? More explainations will be helpful.

Regards
Emily

On Fri, Oct 17, 2014 at 2:15 PM, Jean-Baptiste Onofré <[email protected]>
wrote:

> Hi Christian,
>
> very good initiative, +1 from my side.
>
> Regards
> JB
>
>
> On 10/17/2014 03:13 PM, Christian Schneider wrote:
>
>> I have recently created a maven plugin that generates blueprint.xml from
>> CDI, JEE and Spring annotations.
>>
>> https://github.com/cschneider/blueprint-maven-plugin
>>
>> What makes this different from the blueprint annotations support we
>> already got in aries?
>> ------------------------------------------------------------
>> ------------------------------------------------------------
>>
>>
>> - The blueprint annotations follow the xml style of binding to an exact
>> bean id.
>> The annotations I used by default bind simply by type which is much
>> simpler to manage and more in line with Spring @Autowired and CDI @Inject.
>> Still they also allow to bind by name using @Named
>> - The aries blueprint annotations are processed at runtime but create
>> xml under the covers. My plugin on the other hand does all the work at
>> build time.
>> So at runtime you can install into any existing container running
>> blueprint - no additional deps needed.
>> - My plugin uses standard CDI/JEE annotations and where there is no
>> standard (Services) pax cdi annoations. So people using this style can
>> transition from and to real CDI quite easily. People with JEE background
>> also feel at home with this style.
>> - My plugin also supports some spring annotations like @Autowired,
>> @Component, @Value. This allows a very fast migration from spring to
>> blueprint. In fact I used it in a quite big customer project for that case
>>
>> Sample application
>> -------------------------
>>
>> I created an example application that shows how the following features:
>> - internal wiring
>> - container managed JPA with transactions
>> - using and offering OSGi services
>>
>> https://github.com/cschneider/Karaf-Tutorial/tree/master/tasklist-cdi
>>
>> Here are the most important classes that show the annotations:
>> https://github.com/cschneider/Karaf-Tutorial/blob/master/
>> tasklist-cdi/persistence/src/main/java/net/lr/tasklist/persistence/impl/
>> TaskServiceImpl.java
>>
>> https://github.com/cschneider/Karaf-Tutorial/blob/master/
>> tasklist-cdi/ui/src/main/java/net/lr/tasklist/ui/TaskListServlet.java
>>
>> https://github.com/cschneider/Karaf-Tutorial/blob/master/
>> tasklist-cdi/persistence/src/main/java/net/lr/tasklist/
>> persistence/impl/InitHelper.java
>>
>>
>> Here is the generated xml for:
>> - persistence https://gist.github.com/cschneider/763785e3d4faed89d36b
>> - ui https://gist.github.com/cschneider/6ef0872919299eb0b774
>>
>> You can run the example easily in karaf by following the readme.
>>
>> What is missing ?
>> -----------------------
>>
>> Currently I only have support for binding configs from config admin by
>> using the spring @Value annotation.
>> Adding a similar non spring annotation would be simple but I am a bit
>> hesitant to create my own annotations. Does anyone know existing
>> annotations that would
>> match?
>>
>> Future at aries?
>> ---------------------
>>
>> I started with the plugin on github to get fast results. Now for the
>> longer term I would like to put it into a community so there are
>> official releases as well as hopefully contributions by others.
>> So as blueprint lives at aries this is my first choice.
>>
>> The plugin is already using Apache License but of course I would have to
>> refactor it to the aries namings and other coding standards.
>>
>> So what do you think?
>>
>> Christian
>>
>>
> --
> Jean-Baptiste Onofré
> [email protected]
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



-- 
Thanks
Emily
=================
Emily Jiang
[email protected]

Reply via email to