Peter Johnson wrote:You don't want to do this.
First, servlets must reside in the WEB-INF/lib directory. (Well, let me say I've never heard of them being outside of it.)
Second, WARs are not transparent, any classes residing in JARs outside of the WAR will not have visibility to classes inside the WAR. This can lead to class not found exceptions.
If you have some utility classes that you are sure won't need to call back into classes in the WAR, you can do it this way: you will need 2 projects, one to build the WAR, the other to build the EAR.
The POM for the WAR should indicate the "provided" scope for all of the dependencies that go into the EAR/lib directory. This way the compile can use them to compile your servlets, yet won't package them into the WEB-INF/lib directory.
The POM for the EAP would list the the JARs that go into EAR/lib as dependencies.
(That is sort of off the top of my head, I haven't tried it before and rarely build EARs)
[compiler:compile] Compiling 432 source files to C:\Beta\ECORP5\ECORP5-web\target\classes ------------------------------------------------------------- COMPILATION ERROR : ------------------------------------------------------------- \Beta\fin\fin-web\src\main\java\com\comp\fin\utils\Formatter.java:[23,-1] cannot access javax.annotation.PostConstruct bad class file: C:\Beta\fin\fin-web\target\endorsed\javaee-endorsed-api-6.0.jar(javax/annotation/PostConstruct.class) class file has wrong version 50.0, should be 49.0 1 error
Mark Spritzler wrote:One User could reference another User.
And while I see no benefit of having an object reference itself, I don't see exactly why that couldn't happen. Unless it has to pass itself into its own constructor.
Autowired is an Annotation, when you tell Spring you have it and to do something about it, then Spring will go out and look at all of its beans it has and find one that is of type User. If it finds one then it injects it. With just @Autowired and it finds more than one, then it throws an exception because it autowires by type by default and if there is any ambiguity, you have to tell spring how to fix it.
Mark