SourceForge.net Logo
Main Overview Wiki Issues Forum Build Fisheye
Issue Details (XML | Word | Printable)

Key: CMP-280
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Shay Banon
Reporter: James Strachan
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Compass

strange configuration bug when trying to wire things up in Spring

Created: 03/Oct/06 08:53 AM   Updated: 23/Oct/07 01:27 PM
Component/s: Compass::Gps, Compass::Spring
Affects Version/s: 1.1 M2
Fix Version/s: 2.0 M1


 Description  « Hide
when using this config file

https://svn.opensymphony.com/svn/sandbox/able/sandbox/able-web/src/main/resources/services.xml

(search for <!-- Compass --> to see the compass stuff) it seemed there was some lifecycle issue meaning I couldn't configure the 2 properties so I had to hack up my own wrapper, AbleJpaGpsDevice which set the properties first in the constructor before the service could be started.

https://svn.opensymphony.com/svn/sandbox/able/sandbox/able-web/src/main/java/com/opensymphony/able/compass/AbleJpaGpsDevice.java

as it seems like the SingleCompassGps was starting the JpsGpsDevice before it could have its properties configured or something. Any ideas? I'd like to ditch my crappy wrapper class. Maybe add a new constructor to JpaGpsDevice allowing the injectEntityLifecycleListener and mirrorDataChanges to be passed in as constructor args?



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Shay Banon added a comment - 03/Oct/06 05:23 PM
I have no problem with adding this constructor, it is pretty simple. What I am concerned about is that something is wrong in how Compass can be configured in Spring with the wrapper maybe? You have other optional things to inject into JpaGpsDevice, and they won't be injected in such a case that you describe. I will try to run able and check why things are not injected, will report back.

Henrik Lundahl added a comment - 18/Oct/07 12:18 PM
This sounds a lot like the same problem I was having with ResultSetJdbcGpsDevice. It happens when using autowiring, e.g. default-autowire="byType". The reason is that AbstractGpsDevice has a setGps and Spring therefore thinks that the Gps bean needs to be populated before the GpsDevice bean. Just remove the autowiring, possibly only for the GpsDevice bean, and the wiring will work fine.

I don't know if any changes should be done so users can avoid this. Perhaps the check for device name should be moved to a later stage. Otherwise a warning about autowiring somewhere could be helpful.


Shay Banon added a comment - 23/Oct/07 01:27 PM
Very simple fix, I change the setGps method name to injectGps. Since this is used internally, no problem here (when adding a device to CompassGps, it will inject itself into the device).