简体   繁体   中英

Cannot put my DatabaseHelper spring project to work for my web service

I'm new with Spring but managed to create a DatabaseHelper project using it and others projects in my first solution are calling that helper to execute cruds and all is working fine.

Now I'm creating a second solution, a web service, and in this new solution I'll need to make a couple of selects. I got the "easiest" path and included my DatabaseHelper to the new solution.

Everything compiles fine but at my DatabaseHelper core something go wrong. at the line:

 return (IService)SpringSingulizer.SpringHelper.GetObject(contextName, "ServiceImpl");

Spring is unable to find that ServiceImpl object. That's strange since it works fine at my first solution. For sure I forgot something or its because web services works another way.

After diggind in a bit I found Spring needs a ResourceModule class to load that SpringServices.xml where Spring can find that ServiceImpl class definition.

For my first solution that is achieved just by declaring that class and putting that class and XML at the project calling the helper.

I'm not sure how to do the same for my web service nor if it the way it's supposed to work. And my question is how to put my helper to work for my second solution ?

I find the problem after digging deeper and deeper. First problem is there are already another context with another name but returning spring GetObject default object. Second problem was context handling was a bit messed because there are another class build by a coworker trying to create context by itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM