Bug 746970

Summary: Spring component scanning does not work with Spring 2.5 and EAP 6
Product: [Retired] JBoss Enterprise WFK Platform 2 Reporter: Oliver Kišš <okiss>
Component: SpringAssignee: Marius Bogoevici <mariusb>
Status: CLOSED WORKSFORME QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.0.0.GACC: kpiwko, mnovotny, oskutka, rnewton, rruss
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-05 02:45:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
WAR of an affected application
none
WAR with corrections none

Description Oliver Kišš 2011-10-18 12:50:41 UTC
Description of problem:

Spring context:component-scan does not detect classes with Spring 2.5 and EAP6

When "<context:component-scan base-package="org.package"/>" is added to Spring XML, none of components (annotated with @Component, @Controller, etc) located in base-package are autodetected.

Classes have to be defined manually in the xml
(for example
<bean id="clinicController" class="org.springframework.samples.petclinic.web.ClinicController"/>)
because autodetection does not work.

Comment 1 Marius Bogoevici 2011-10-18 13:02:22 UTC
Running Spring 2.5 on EAP5 or later requires the use of Snowdrop.

http://docs.redhat.com/docs/en-US/JBoss_Web_Framework_Kit/1.2/html/Snowdrop_User_Guide/ch02.html#id3193965

Comment 2 Oliver Kišš 2011-10-19 08:17:37 UTC
Created attachment 528939 [details]
WAR of an affected application

Comment 3 Oliver Kišš 2011-10-19 08:22:53 UTC
I didn't provide enough information, I'm sorry. Snowdrop is being used.

I added attachment with WAR of the application.

Comment 4 Rebecca Newton 2012-03-08 01:31:47 UTC
Tech note?

Comment 5 Marek Novotny 2012-03-09 08:34:09 UTC
Marius, could you fill technical note for this?

Comment 6 Marius Bogoevici 2012-03-09 15:40:27 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
TBD

Comment 7 Rebecca Newton 2012-03-12 00:31:14 UTC
Drafted a technical note, let me know what you think.

Comment 8 Rebecca Newton 2012-03-12 00:31:14 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-TBD+The Spring context:component-scan fails to auto-detect classes with Spring 2.5 on EAP 6. The workaround for this issue is to manually define the classes in the XML.

Comment 9 Marius Bogoevici 2012-03-12 03:26:10 UTC
Created attachment 569268 [details]
WAR with corrections

Corrections made as follows:

- fixed web.xml to enable Snowdrop correctly
- replaced Snowdrop 2.0.0.CR1 with 2.0.3.Final (as used by WFK2)

Comment 10 Marius Bogoevici 2012-03-12 03:32:14 UTC
I don't think we need a technical note for this as the issue is obsolete.

The reason why the submitted example failed was that Snowdrop was enabled incorrectly (verified and attached working example with Snowdrop enabled correctly).

It can be verified by navigating to http://localhost:8080/petclinic-fixed/addPet.do (controller is enabled_

Please note that http://localhost:8080/petclinic-fixed/welcome.do does not work in this version because ClinicController is annotated with @Component instead of @Controller

Comment 11 Karel Piwko 2012-03-13 16:47:36 UTC
Deleted Technical Notes Contents.

Old Contents:
The Spring context:component-scan fails to auto-detect classes with Spring 2.5 on EAP 6. The workaround for this issue is to manually define the classes in the XML.

Comment 12 Marius Bogoevici 2012-03-13 17:14:03 UTC
Confirmed, should be closed and removed.