This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 207069

Summary: Spring Imrovement: JSR330 support.
Product: javaee Reporter: hantsy <hantsy>
Component: SpringAssignee: Martin Fousek <marfous>
Status: REOPENED ---    
Severity: normal CC: ads, markiewb
Priority: P3    
Version: 7.1   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Added a screenshot for this hints.

Description hantsy 2012-01-09 16:03:51 UTC
Spring 3.x support JSR330 auto of box, but NetBeans reported an error in Spring project, and it required a beans.xml to be created which is not needed in Spring projects.

1. Detect spring and do not show the error.
2. Code assistance for interoperability of JSR 330(@Named)and spring beans , such as Code completion, refactoring, Find Usage etc.
Comment 1 Martin Fousek 2012-01-10 08:56:27 UTC
Thanks for entering an issue for that. Not sure what all exactly you mean by the point 1. and 2. but at least we could focus on the base - enabling CDI for Spring 3.x projects firstly.

CCing Denis as an author of CDI feature... Denis, I saw that you are probably getting information about project with enabled CDI from project.lookup or using CdiUtil.isCdiEnabled. Aren't you planning friend SPI where implementors could implement similar method as well in the future? Then you would take results and if any of them would be true, CDI would be enabled for the project.
Comment 2 hantsy 2012-01-10 09:12:33 UTC
1, When I used NetBeans to develop my Spring applciation, it will report an error in editor about using @Named without beans.xml..and provided Hint to create beans.xml, we do not need it at all in Spring application.
2.  For example, Code completion, when using  @Inject @Named() the named value should show all spring beans and beans annotated with @Named, and when using @Autowired @Qulifier() also can provid CC options of all beans(normal spring beans and @Named beans).
Comment 3 hantsy 2012-01-10 09:14:56 UTC
This feature is from JSR 330, not jsr299, Spring only support JSR 330 officially.
Comment 4 Denis Anisimov 2012-01-10 09:35:52 UTC
(In reply to comment #1)
> Thanks for entering an issue for that. Not sure what all exactly you mean by
> the point 1. and 2. but at least we could focus on the base - enabling CDI for
> Spring 3.x projects firstly.
> 
> CCing Denis as an author of CDI feature... Denis, I saw that you are probably
> getting information about project with enabled CDI from project.lookup or using
> CdiUtil.isCdiEnabled. Aren't you planning friend SPI where implementors could
> implement similar method as well in the future? Then you would take results and
> if any of them would be true, CDI would be enabled for the project.

CDI spec is implemented in the existed NB modules and doesn't 
required currently to be extended.
This issue is not about CDI. This is about usage annotations 
defined in the JSR 330. 
That annotations are used differently in the CDI 
( which is complete JSR 299 spec )  and in the Spring.
So the answer is no: no friend SPI and extending in existing CDI support 
is planned.
Comment 5 Denis Anisimov 2012-01-10 09:41:16 UTC
(In reply to comment #2)
> 1, When I used NetBeans to develop my Spring applciation, it will report an
> error in editor about using @Named without beans.xml..and provided Hint to
> create beans.xml, we do not need it at all in Spring application.
Right. This is an issue. 
We need to distinguish presence of JSR330 and JSR299 in the project.
All CDI hints should be enabled only if there is JSR299 .
Please file a separate issue about this with CDI component. 
This is separate issue ( not Spring ).
> 2.  For example, Code completion, when using  @Inject @Named() the named value
> should show all spring beans and beans annotated with @Named, and when using
> @Autowired @Qulifier() also can provid CC options of all beans(normal spring
> beans and @Named beans).
That's pure Spring functionality based on JSR330 Spring specific 
annotations treating.  This is not a bug because this functionality was never planned. This is an Enhancement .
Comment 6 Denis Anisimov 2012-01-10 10:02:49 UTC
(In reply to comment #5)
> (In reply to comment #2)
> > 1, When I used NetBeans to develop my Spring applciation, it will report an
> > error in editor about using @Named without beans.xml..and provided Hint to
> > create beans.xml, we do not need it at all in Spring application.
> Right. This is an issue. 
> We need to distinguish presence of JSR330 and JSR299 in the project.
> All CDI hints should be enabled only if there is JSR299 .
> Please file a separate issue about this with CDI component. 
> This is separate issue ( not Spring ).

By the way I just checked the code and realized that beans.xml hint could be 
shown only if JSR299 is also available in the project.
So please provide exact steps to reproduce. All CDI related hints are enabled 
if project classpath has JSR299 classes . I believe this is your case.
So I don't see a way how I can detect that one don't need JSR299 based on 
project information ( classpath ). You don't want to use JSR299 
( but it is available ) but someone else wants to use it. So I don't see an easy
way to disable CDI hints. The only way that I can suggest here : disable hints via global preferences .
Comment 7 Martin Fousek 2012-01-10 10:43:40 UTC
(In reply to comment #4)
> CDI spec is implemented in the existed NB modules and doesn't 
> required currently to be extended.
> This issue is not about CDI. This is about usage annotations 
> defined in the JSR 330. 
> That annotations are used differently in the CDI 
> ( which is complete JSR 299 spec )  and in the Spring.
> So the answer is no: no friend SPI and extending in existing CDI support 
> is planned.

Thank you Denis for your information.

hantsy: Keeping as enhancement for Spring. Anyway hard to say when could be time for so time-consuming feature.
Comment 8 hantsy 2012-01-10 10:53:37 UTC
Created attachment 114761 [details]
Added a screenshot for this hints.

I do not need this hint, but need jsr330 support in Spring.
Comment 9 Denis Anisimov 2012-01-10 10:56:46 UTC
(In reply to comment #8)
> Created attachment 114761 [details]
> Added a screenshot for this hints.
> 
> I do not need this hint, but need jsr330 support in Spring.

>So please provide exact steps to reproduce. All CDI related hints are enabled 
>if project classpath has JSR299 classes . I believe this is your case.
>So I don't see a way how I can detect that one don't need JSR299 based on 
>project information ( classpath ). You don't want to use JSR299 
>( but it is available ) but someone else wants to use it. So I don't see an
>easy way to disable CDI hints. The only way that I can suggest here : 
>disable hints via global preferences .
Could you please point what exactly is not clear here ?
Comment 10 hantsy 2012-01-10 10:58:40 UTC
it is clear, thanks
Comment 11 Martin Balin 2016-07-07 08:56:01 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 12 markiewb 2016-07-10 20:49:21 UTC
Still valid in 8.2 dev 
Product Version: NetBeans IDE Dev (Build 201607100002)