-
Aug 9th, 2011, 09:00 AM
#1
@Autowired and services in a jar
Hi,
I've created 2 projects, the first one is my core. It has the following packages:
-core.controller
-core.service
-core.dao
-core.entity
»» All the above classes were packaged in a jar.... core.jar
The second project has the code to expose my controller as rest:
»» This project uses core.jar
-web.rest
....
Controller
@Component(value = "testController")
public class TestControllerImpl implements TestController{
....
Rest
@Component
@Path("/test")
@Scope("request")
public class TestResourceRest implements TestResource {
@Autowired
private TestController testController;
....
The problems is that I'm getting the following error when I try to access my resource localhost:8080/myproject/test
No matching bean of type [core.controller.TestController] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
What am I doing wrong?
Thanks in advance!
-
Aug 9th, 2011, 09:08 AM
#2
Adding more information...
If I copy and paste the .class files (project core) inside my web project "rest" »» rest\WEB-INF\classes, the tag @Autowired works
so strange for me..
-
Aug 9th, 2011, 01:34 PM
#3
Solved!
I just selected "Add directory entries" when building the jar using eclipse.
-
Sep 19th, 2011, 10:27 AM
#4
Thank you rafoli. Your solution works fine for me too.
Thanks again for posting it.
-
Jul 15th, 2012, 01:58 AM
#5
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules