Results 1 to 4 of 4

Thread: Resource Availability @Test / MVC

  1. #1

    Question Resource Availability @Test / MVC

    Hello friends -

    New to Spring and STS so hopefully this isn't too dumb a question. Anyways, created a spring/mvc/hibernate project. Put some @RunWith(SpringJunit4ClassRunner) classes underneath /src/test/java. In src/main/resources/ I put applicationContext.xml + and similar files. Great. Ran some Junits and things were autowiring / applicationContexting, whatever.

    Tried the MVC end. Wound up having to clone my /main/resources files into src/main/webapp/web-inf.

    Whatever I tried, however, I could not seem to enable my classes in /scr/test/java to see resource files in /src/main/webpap/web-inf. Considering that I've got to keep things moving, I just have been keeping two copies of applicationContext.xml even though it's dumb as hell.

    What am I doing wrong?

    Thanks a lot.

    brian

  2. #2
    Join Date
    Sep 2008
    Location
    Hamburg, Germany
    Posts
    1,637

    Default

    Hey Brian!

    I am not sure how you created and setup your project, but is it a dynamic web project in Eclipse/STS? And if so, did you take a look at the deployment assembly in the project properties?

    I can imagine that this sounds a bit complicated when starting with Spring and STS, so I would recommend to start with a fresh Spring MVC project using the Spring Template projects. From there you can easily create a Spring MVC project that works out-of-the-box. In addition to that I would also recommend these resources for how-to-get-started:

    http://forum.springsource.org/showth...etting-Started

    HTH,
    Martin
    Martin Lippert
    SpringSource, a division of VMware
    SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/martinlippert

  3. #3

    Default

    Hi Martin -

    Thanks for the response. I think maybe I did a poor job of describing my problem. I created my project using the STS template and then chose 'Spring MVC Project' (not a dynamic web project).

    Anyway, the structure that it created for me struck me as kind of odd, but I kept slugging away and have things running. I can run my Junits successfully. Also, I can run my application (as it exists so far) through a web browser / MVC style. BUT. What I cannot seem to do is have my junit tests see ApplicationContext that resides underneath webapps/web-inf. See the attached screenshot for what my environment looks like and what can see what.

    Thanks!

    brian
    sts-view.jpg

  4. #4
    Join Date
    Oct 2012
    Location
    Krakow, Poland
    Posts
    12

    Default

    Hi Brain,

    Is there any chance for zipping the project and publishing it somewhere? A github repo would also work. The screenshot is quite blurry.

    Cheers,
    --
    Tomasz Zarna
    Software Engineer, IDE Tools
    Committer, Eclipse Platform, Orion, EGit
    http://tasktop.com

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
  •