20041208 Wednesday December 08, 2004

[DJUG] JMS and Spring Tonight's DJUG should be a fun one. First, I hope to learn some JMS tips and tricks from Chris Huston then I'm doing a presentation on Spring. I asked the group what they wanted to know about Spring last week and I got a wide range of answers. There should be a good mix of newbies and experienced Spring users. I'll give you a link to my presentation, but I have to warn you that there's not much there. I tend to show a lot of code in and do demos when I present, so my presentations tend to be kinda thin. My two goals for tonight are 1) keep it under an hour so we can all get to the bar and 2) inspire Spring-mania among the crowd.

   Download Presentation »

Posted in Java at Dec 08 2004, 05:00:51 PM MST 6 Comments

Comments:

Matt, First, I wish I was going to be there for the presentation (secretly just for the beer ;~) but stuck here in Houston. Anyhow, one comment on your presentation if I may as it coincides with my earlier attempts today to set up the context [XmlWebApplicationContext] in a static block for a BaseTestCase. This is what I believe you are referring to? Assuming so, I did come across one issue with doing this. The test class in question has two tests both of which look up a file using the getResource() method. InputStream is = ctx.getResource(file).getInputStream(); Now the first test runs just fine and finds the file, however, the second test fails and throws a FileNotFound exception. Now when I move the set up of the context to the setUp() method out of the static block both tests execute with success (i.e. both files found). Why might this be? Otherwise, the set up of the context in the static block for my other tests works just fine. Even so, doesn't this [initialization of the context in a static block] kinda go against the goal of the unit tests wherein you should always have a clean slate from test to test which is the goal behind the setUp() and tearDown() methods.?. Meaning that you should destroy and create the context for each test. Anyhow, I have read your blog for quite some time and because of you I have gotten my previous team/employer to use equinox, spring, and appfuse. Keep up the great work, don't know how you do it.

Posted by Harold Neiper on December 08, 2004 at 10:06 PM MST #

Matt, was your presentation recorded by any chance? I'd love to hear it during my commute. (btw, thanks for Spring Live and appfuse)

Posted by Gene Garcia on December 09, 2004 at 09:45 AM MST #

Dear Matt, As I ran through your Spring presentation, I found great enthousiasm for Spring. Nothing wrong with that, but why was Spring not that strong competitor in your presentation for 'Comparing Web Frameworks' (https://equinox.dev.java.net/framework-comparison/WebFrameworks.pdf) than. Your opion about Spring on the 'My Opnion' page was not at all positive. It did not even emerge on your 'Which should I choose?' page. In fact I fully subscribe to your conclusions there. Ok, insights can change over time, but hey, this 'Comparing Web Frameworks' presentation, was only recently presented on November 5th, 2004. Kind regards, Marcel.

Posted by Marcel Zeeuw on December 09, 2004 at 11:03 AM MST #

Harold - that is a strange. Maybe the Resource is using something from Spring's context file or tying into it somehow? The static thing won't always work (as you pointed out), but it tends to be the fastest way (in my tests) to load the context and keep it around for all your tests. I realize the purpose of setUp() and tearDown(), but the context never changes between tests, so why reload it? This is mainly a speed issue. If you have a large context file - it can take a few seconds to load before each test.

Gene - no, I don't believe the presentation was recorded.

Marcel - I think all the frameworks mentioned in my frameworks comparison are good choice. The main reason I chose Struts was because I know it so well. I know how to do indexed properties and make it all work in a matter of minutes. I know what when wrong when I see certain error messages. This is mainly based on experience - since I've used Struts for 3.5 years now. I do plan on using a different framework on my next project (if the client lets me), so I'm sure my opinion will change over time. I recently chose Struts for my current project b/c the client already uses Struts and has the knowledge in-house. I don't know if I would choose Spring over JSF or Tapestry - they both have some pretty slick components. If I needed graphing my next app - I'd probably choose Tapestry b/c of its slick chart component. Also, since all frameworks are in AppFuse/Equinox - it's easy to get up and running with them quickly. ;-)

Posted by Matt Raible on December 09, 2004 at 02:50 PM MST #

Matt, well after some digging I found why this was not working. I was creating a WebApplicationContext in the utility method to lookup the files and setting it to this --> ctx = RequestContextUtils.getWebApplicationContext(request); Anyhow, replaced that and instead now I am using this --> request.getSession().getServletContext().getResourceAsStream(file) to get a resource. Once all was said and done then the static implementation of the context initialization worked just fine for all tests. Anyhow, thought you might like to know. - thx again for the great code examples!

Posted by Harold Neiper on December 10, 2004 at 01:38 PM MST #

Matt, How about putting up your code online too? That's like butter the bread. You don't want to be eating plain bread do you? :)

Posted by Akki on January 07, 2008 at 04:16 AM MST #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is a Web Architecture Consultant specializing in open source frameworks.
« May 2012
SunMonTueWedThuFriSat
  
1
2
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
23
24
25
26
27
28
29
30
31
  
       
Today

Recent Entries

Tag Cloud