<?xml version="1.0"?>
<rss version="2.0">
<channel>
  <title>JavaGeek.org - spring tag</title>
  <link>http://javageek.org/tags/spring/</link>
  <description>For the love of Java</description>
  <language>en</language>
  <copyright>Guillermo Castro</copyright>
  <lastBuildDate>Fri, 12 Nov 2010 16:04:24 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  
  
  <item>
    <title>WSAD doesn&#039;t suck so much after all</title>
    <link>http://javageek.org/2006/04/20/wsad_doesnt_suck_so_much_after_all.html</link>
    
      
        <description>
          The last couple of weeks have been very interesting, as I was in the last stages of a project at work. I no longer hate WSAD (Websphere Studio Application Developer) so much. I still find a lot of missing features from the latest Eclipse releases (WSAD is based on Eclipse 2.x), but I found the integration with Websphere to be very nice, and developing EJBs is almost easy.&lt;br /&gt;&lt;br /&gt;However, the more I use EJBs, the less I like them. After using Spring to create POJO-like services, EJBs feel too cumbersome, not to mention that we mostly do Stateless Session Beans and never even touch Entity Beans, as they impact performance too&amp;nbsp; much. So, there&#039;s really not much sense in using EJBs.&lt;br /&gt;&lt;br /&gt;One of the main things I don&#039;t like about EJBs is that they&#039;re not easy to test. With Spring, I could easilly do testing, and not only unit testing but also Integration testing, using Spring&#039;s AbstractTransactionalDataSourceSpringContextTests, which allows me to insert and update the database and rollback those changes afterwards, so the db isn&#039;t affected. With EJBs, so far I&#039;ve only found Cactus, and I still feel a little vague on how to exactly use it, since EJBs are required to run inside an Appserver.&lt;br /&gt;&lt;br /&gt;Anyway, I was able to finish the project, and WSAD helped.&lt;br /&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;!--
&lt;rdf:RDF xmlns:rdf=&#034;http://www.w3.org/1999/02/22-rdf-syntax-ns#&#034;
         xmlns:dc=&#034;http://purl.org/dc/elements/1.1/&#034;
         xmlns:trackback=&#034;http://madskills.com/public/xml/rss/module/trackback/&#034;&gt;
&lt;rdf:Description
    rdf:about=&#034;http://javageek.org/2006/04/20/wsad_doesnt_suck_so_much_after_all.html&#034;
    dc:identifier=&#034;http://javageek.org/2006/04/20/wsad_doesnt_suck_so_much_after_all.html&#034;
    dc:title=&#034;WSAD doesn&#039;t suck so much after all&#034;
    trackback:ping=&#034;http://javageek.org/addTrackBack.action?entry=1145544965690&amp;token=8369267657331756070&#034; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
        </description>
      
      
    
    
    
    <category>Java</category>
    
    <category>J2EE</category>
    
    <comments>http://javageek.org/2006/04/20/wsad_doesnt_suck_so_much_after_all.html#comments</comments>
    <guid isPermaLink="true">http://javageek.org/2006/04/20/wsad_doesnt_suck_so_much_after_all.html</guid>
    <pubDate>Thu, 20 Apr 2006 14:56:05 GMT</pubDate>
  </item>
  
  <item>
    <title>Unit Testing with Mock Objects (and Spring)</title>
    <link>http://javageek.org/2005/12/06/unit_testing_with_mock_objects_and_spring.html</link>
    
      
        <description>
          I was looking into some information on how to do &lt;a href=&#034;http://en.wikipedia.org/wiki/Unit_testing&#034;&gt;unit testing&lt;/a&gt; using &lt;a href=&#034;http://en.wikipedia.org/wiki/Mock_Object&#034;&gt;mock objects&lt;/a&gt;. Since I&#039;m using Spring, I&#039;m also considering this into the equation.&lt;br /&gt;&lt;br /&gt;So far, I have found some nice articles, like &lt;a href=&#034;http://www.shinetech.com/display/www/Unit+Testing+with+Mock+Objects&#034;&gt;this one&lt;/a&gt; linked from &lt;a href=&#034;http://www.theserverside.com/news/thread.tss?thread_id=30257&#034;&gt;TheServerSide&lt;/a&gt;, which talks about unit testing and mock objects in general, and provide some examples. &lt;br /&gt;&lt;br /&gt;I have also found several mock object libraries:&lt;br /&gt;&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href=&#034;http://www.easymock.org/&#034;&gt;EasyMock&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href=&#034;http://www.mockobjects.com/DynaMock.html&#034;&gt;DynaMock&lt;/a&gt;     &lt;/li&gt;
    &lt;li&gt;&lt;a href=&#034;http://jmock.codehaus.org/&#034;&gt;jMock&lt;/a&gt; (It&#039;s actually DynaMock redone)&lt;/li&gt;
&lt;/ul&gt;
I&#039;m wondering what people have done in this area. It seems that using mock objects is an ideal match for unit testing, and something that should be more thoroughly integrated.
&lt;!--
&lt;rdf:RDF xmlns:rdf=&#034;http://www.w3.org/1999/02/22-rdf-syntax-ns#&#034;
         xmlns:dc=&#034;http://purl.org/dc/elements/1.1/&#034;
         xmlns:trackback=&#034;http://madskills.com/public/xml/rss/module/trackback/&#034;&gt;
&lt;rdf:Description
    rdf:about=&#034;http://javageek.org/2005/12/06/unit_testing_with_mock_objects_and_spring.html&#034;
    dc:identifier=&#034;http://javageek.org/2005/12/06/unit_testing_with_mock_objects_and_spring.html&#034;
    dc:title=&#034;Unit Testing with Mock Objects (and Spring)&#034;
    trackback:ping=&#034;http://javageek.org/addTrackBack.action?entry=1133881019927&amp;token=-1383289076538984047&#034; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
        </description>
      
      
    
    
    
    <category>Java</category>
    
    <comments>http://javageek.org/2005/12/06/unit_testing_with_mock_objects_and_spring.html#comments</comments>
    <guid isPermaLink="true">http://javageek.org/2005/12/06/unit_testing_with_mock_objects_and_spring.html</guid>
    <pubDate>Tue, 06 Dec 2005 14:56:59 GMT</pubDate>
  </item>
  
  <item>
    <title>Accessing a Spring bean from a servlet</title>
    <link>http://javageek.org/2005/09/23/accessing_a_spring_bean_from_a_servlet.html</link>
    
      
        <description>
          I&#039;m using &lt;a href=&#034;http://ajaxtags.sourceforge.net/&#034;&gt;Ajaxtags&lt;/a&gt; to implement an ajax-enabled form with dynamic dropdown fields. In order to access my DAO object (which is a &lt;a href=&#034;http://springframework.org/&#034;&gt;Spring&lt;/a&gt; managed bean)&amp;nbsp; to get the dropdown options, I had to have access to the Application context from a regular Servlet.&lt;br /&gt;&lt;br /&gt;The solution is very simple, but since I had some troubles finding it, I&#039;m adding it here for future reference, and for anyone who&#039;s looking for the same. Basically, you use the &lt;a href=&#034;http://static.springframework.org/spring/docs/1.2.x/api/org/springframework/web/context/support/WebApplicationContextUtils.html&#034;&gt;WebApplicationContextUtils&lt;/a&gt; object from the spring framework to get a reference to your bean. Inside the &lt;span style=&#034;font-style: italic;&#034;&gt;doGet()&lt;/span&gt; method I have:&lt;br /&gt;
&lt;pre class=&#034;codeSample&#034;&gt;ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());&lt;br /&gt;Object myDao = context.getBean(&amp;quot;daoBeanName&amp;quot;);&lt;/pre&gt;
&lt;br /&gt;It&#039;s that easy... really.
&lt;!--
&lt;rdf:RDF xmlns:rdf=&#034;http://www.w3.org/1999/02/22-rdf-syntax-ns#&#034;
         xmlns:dc=&#034;http://purl.org/dc/elements/1.1/&#034;
         xmlns:trackback=&#034;http://madskills.com/public/xml/rss/module/trackback/&#034;&gt;
&lt;rdf:Description
    rdf:about=&#034;http://javageek.org/2005/09/23/accessing_a_spring_bean_from_a_servlet.html&#034;
    dc:identifier=&#034;http://javageek.org/2005/09/23/accessing_a_spring_bean_from_a_servlet.html&#034;
    dc:title=&#034;Accessing a Spring bean from a servlet&#034;
    trackback:ping=&#034;http://javageek.org/addTrackBack.action?entry=1127516498538&amp;token=3239419165531308239&#034; /&gt;
&lt;/rdf:RDF&gt;
--&gt;
        </description>
      
      
    
    
    
    <category>Tips</category>
    
    <comments>http://javageek.org/2005/09/23/accessing_a_spring_bean_from_a_servlet.html#comments</comments>
    <guid isPermaLink="true">http://javageek.org/2005/09/23/accessing_a_spring_bean_from_a_servlet.html</guid>
    <pubDate>Fri, 23 Sep 2005 23:01:38 GMT</pubDate>
  </item>
  
  </channel>
</rss>

