Results 1 to 6 of 6

Thread: Injecting properties into ApiController (MVC4 WebApi) derive clasees

  1. #1
    Join Date
    Apr 2012
    Posts
    13

    Default Injecting properties into ApiController (MVC4 WebApi) derive clasees

    Hi there,

    First of all I want to thank you for your great job in Spring.Net. It's really amazing! Thank you.

    I hope this is the right forum where to ask. If not please accept my apologize.
    As per subject, I would like to inject properties into ApiController derived classes in MVC4 Web Api, but I couldn't find how googling around.

    At this time I'm inherithing from Spring.Web.Mvc3.SpringMvcApplication, but it seems it does not perform injection into ApiController derived classes.

    Thank you in advance for your help.
    --
    dante

  2. #2
    Join Date
    Jul 2010
    Posts
    245

    Default

    You're definitely in the right place -- welcome

    Unfortunately I have to report that you're quite right: the Spring.Web.Mvc3.SpringMvcApplication was designed/built *before* the release of the recent WebAPI and so it most definitely doesn't support the new ApiController (or even the MVC4 Controller completely) as of yet. We are working on a release that will properly support the full compliment of DI features in both MVC4 and the HTTP WebApi release but these are not yet ready/working/releasable. Look for this in the upcoming SPRNET 2.0 release in JUN/JUL of this year but in the mean time you can also watch this JIRA issue https://jira.springsource.org/browse/SPRNET-1497 to track the progress.

    This work is underway now and will be committed well-prior to the upcoming release, meaning that once complete/the issue is closed it will be available in the nightly builds here http://www.springframework.net/downloads/nightly/

    Thanks,
    -Steve B.

  3. #3
    Join Date
    Apr 2012
    Posts
    1

    Default Quick solution

    Well' I implemented a quick solution, which you can download here (thre classes): http://www.beller-it.de/download/spring.net-webapi.zip
    If your global.asax inherited from SpringMvcApplication, all you need to do is to let it inherit from WebApiSpringMvcApplication now.

    For me it works.

  4. #4
    Join Date
    Apr 2012
    Posts
    13

    Default

    Excellent!

    Thank you very much

  5. #5
    Join Date
    Jul 2010
    Posts
    245

    Default

    Just circling back on this thread to advise everyone that https://jira.springsource.org/browse/SPRNET-1497 has now been completed. You can either get the code from http://github.com/springsource/spring-net and compile it for yourselves or wait until this evening's run of the nightly CI build and download it from http://www.springframework.net/downloads/nightly/ (any build *after* the 0502 build should properly contain the Spring.Web.Mvc4 assemblies).

    We'd love for those of you using MVC4 to please test the provided assemblies and provide us with feedback so that any issues found can be addressed before we release SPRNET 2.0 (JUN/JUL time-frame).

    Thanks in advance~!
    -Steve B.

  6. #6
    Join Date
    Apr 2012
    Posts
    13

    Default

    Quote Originally Posted by Steve Bohlen View Post
    ...and download it from http://www.springframework.net/downloads/nightly/ (any build *after* the 0502 build should properly contain the Spring.Web.Mvc4 assemblies).
    Hi there,
    It seems I cannot download the snapshots: it requires me to log in.
    Is there a login page I'm missing somewhere? Does my forum credentials will do the job?

    Thank you for your great and quick work btw

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •