<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Better Software and beyond... &#187; Spring</title>
	<atom:link href="http://www.thorsten-kamann.de/tag/spring/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thorsten-kamann.de</link>
	<description>About architecture, development, quality and more</description>
	<lastBuildDate>Tue, 25 Oct 2011 20:16:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Creating RESTful webservices with the Spring Framework</title>
		<link>http://www.thorsten-kamann.de/2011/10/15/creating-restful-webservices-with-the-spring-framework/</link>
		<comments>http://www.thorsten-kamann.de/2011/10/15/creating-restful-webservices-with-the-spring-framework/#comments</comments>
		<pubDate>Sat, 15 Oct 2011 21:53:52 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[JPA]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Webservice]]></category>
		<category><![CDATA[XStream]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/?p=552</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2011/10/15/creating-restful-webservices-with-the-spring-framework/" title="Creating RESTful webservices with the Spring Framework"></a>With the Spring Framework you can easily create RESTful webservices. This is built-in the MVC part of Spring. In this post I show you how to configure this and offer the consumer the response as XML and as JSON. The domain model &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2011/10/15/creating-restful-webservices-with-the-spring-framework/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2011/10/15/creating-restful-webservices-with-the-spring-framework/" title="Creating RESTful webservices with the Spring Framework"></a>
<p>With the Spring Framework you can easily create RESTful webservices. This is built-in the MVC part of Spring. In this post I show you how to configure this and offer the consumer the response as XML and as JSON.</p>
<h4>The domain model</h4>
<p>First we need a domainmodel. In this sample it is quite simple. It consists of 2 classes: Constellation and ConstellationName.</p>
<p style="text-align: center;"><div class="img size-medium wp-image-553 aligncenter" style="width:300px;">
	<a title="Domain Model" href="http://www.thorsten-kamann.de/wp-content/uploads/2011/10/Domainmodel-of-Tucana.png" rel="lightbox"><img src="http://www.thorsten-kamann.de/wp-content/uploads/2011/10/Domainmodel-of-Tucana-300x141.png" alt="" width="300" height="141" /></a>
	<div>Domainmodel</div>
</div>
<p style="text-align: left;">The Constellation describes an astronomical constellation like Orion, Andromeda and so on. The association to ConstellationName offers names of the constellation in different languages.</p>
<h4>The service model</h4>
<p>In this sample the interface used by clients (web, webservice) is a classical service class. This class &#8211; named ConstellationService &#8211; needs a repository class to access the underlying database.</p>
<p style="text-align: center;"><div class="img size-medium wp-image-554 aligncenter" style="width:300px;">
	<a title="Service Model" href="http://www.thorsten-kamann.de/wp-content/uploads/2011/10/Servicemodel-of-Tucana.png" rel="lightbox"><img src="http://www.thorsten-kamann.de/wp-content/uploads/2011/10/Servicemodel-of-Tucana-300x138.png" alt="" width="300" height="138" /></a>
	<div>Servicemodel</div>
</div>
<h4 style="text-align: left;">Wiring domain and service</h4>
<p>With Spring this is quite easy. You need only a little XML file and some Annotations. In the ConstellationService you add the @Service annotation:</p>
<div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nd">@Service</span></div><div class='line' id='LC2'><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Service</span><span class="o">{</span></div><div class='line' id='LC3'><span class="o">...</span></div><div class='line' id='LC4'><span class="o">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/f40b2955a76a72aee18bad6466db8bd678a925f8/Service.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_service.java" style="float:right;margin-right:10px;color:#666">Service.java</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>This annotation is out of the package <em>org.springframework.stereotype.Service</em>. To inject the repository class you can use the @Inject annotation. If you have setup your JPA environment properly you can access the database and get some Constellation instances.</p>
<h4>Creating the REST service</h4>
<p>Now we have a working backend. But we want to have a RESTful webservice so we need another artifact in our sourcecode: the Controller. A controller is the first item of our application. This means if a client requests data the controller gets the request foremost. The controller then is analyzing and validating the request. After this service will be called, the retrieving data prepared and returned.</p>
<p>In Spring you can add some annotations to a controller method to map this method to the specified URL resource:</p>
<div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nd">@RequestMapping</span><span class="o">(</span><span class="n">value</span> <span class="o">=</span> <span class="s">&quot;/constellations&quot;</span><span class="o">)</span></div><div class='line' id='LC2'><span class="kd">public</span> <span class="n">ModelAndView</span> <span class="nf">getAllConstellations</span><span class="o">()</span> <span class="o">{}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/37442e0e7e14626a0fff7015a6b87e9925c967f1/RequestMapping1.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_request_mapping1.java" style="float:right;margin-right:10px;color:#666">RequestMapping1.java</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>With this mapping this controller method responses to the request http://some-host/constellations only. You can map more complex URL resources too. For instance if you have an URL with parameter. In our service we want to offer a method the client can request for one constellation identified by its code. This can be done with the annotation @RequestMapping and @PathVariable:</p>
<div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nd">@RequestMapping</span><span class="o">(</span><span class="s">&quot;/constellation_by_code/{code}&quot;</span><span class="o">)</span></div><div class='line' id='LC2'><span class="kd">public</span> <span class="n">ModelAndView</span> <span class="nf">findConstellationByCode</span><span class="o">(</span><span class="nd">@PathVariable</span> <span class="n">String</span> <span class="n">code</span><span class="o">)</span> <span class="o">{}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/a0058f8b1ad38cf440d4550e2915e6c11e922ab6/RequestMapping2.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_request_mapping2.java" style="float:right;margin-right:10px;color:#666">RequestMapping2.java</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>With this mapping the part with the {} will be taken as parameter for the method. You can use more placeholder too. For this you can read the <a title="@RequestMapping in the Spring documentation" href="http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-ann-requestmapping" target="_blank">Spring documentation</a>.</p>
<p>Now we have all informations to create the controller class.</p>
<div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nd">@Controller</span></div><div class='line' id='LC2'><span class="kd">public</span> <span class="kd">class</span> <span class="nc">ConstellationServiceController</span> <span class="o">{</span></div><div class='line' id='LC3'>&nbsp;</div><div class='line' id='LC4'><span class="nd">@Inject</span></div><div class='line' id='LC5'><span class="kd">private</span> <span class="n">ConstellationService</span> <span class="n">service</span><span class="o">;</span></div><div class='line' id='LC6'>&nbsp;</div><div class='line' id='LC7'><span class="nd">@RequestMapping</span><span class="o">(</span><span class="n">value</span> <span class="o">=</span> <span class="s">&quot;/constellations&quot;</span><span class="o">)</span></div><div class='line' id='LC8'><span class="kd">public</span> <span class="n">ModelAndView</span> <span class="nf">getAllConstellations</span><span class="o">()</span> <span class="o">{</span></div><div class='line' id='LC9'>&nbsp;&nbsp;<span class="n">List</span><span class="o">&lt;</span><span class="n">Constellation</span><span class="o">&gt;</span> <span class="n">constellations</span> <span class="o">=</span> <span class="n">service</span><span class="o">.</span><span class="na">findAllConstellations</span><span class="o">();</span></div><div class='line' id='LC10'>&nbsp;&nbsp;<span class="n">ModelAndView</span> <span class="n">mav</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ModelAndView</span><span class="o">(</span><span class="s">&quot;xmlView&quot;</span><span class="o">,</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="n">BindingResult</span><span class="o">.</span><span class="na">MODEL_KEY_PREFIX</span> <span class="o">+</span> <span class="s">&quot;constellations&quot;</span><span class="o">,</span> <span class="n">constellations</span><span class="o">);</span></div><div class='line' id='LC12'>&nbsp;&nbsp;<span class="k">return</span> <span class="n">mav</span><span class="o">;</span></div><div class='line' id='LC13'><span class="o">}</span></div><div class='line' id='LC14'>&nbsp;</div><div class='line' id='LC15'><span class="nd">@RequestMapping</span><span class="o">(</span><span class="s">&quot;/constellation_by_code/{code}&quot;</span><span class="o">)</span></div><div class='line' id='LC16'><span class="kd">public</span> <span class="n">ModelAndView</span> <span class="nf">findConstellationByCode</span><span class="o">(</span><span class="nd">@PathVariable</span> <span class="n">String</span> <span class="n">code</span><span class="o">)</span> <span class="o">{</span></div><div class='line' id='LC17'>&nbsp;&nbsp;<span class="n">Constellation</span> <span class="n">constellation</span> <span class="o">=</span> <span class="n">service</span><span class="o">.</span><span class="na">findConstellationByCode</span><span class="o">(</span><span class="n">code</span><span class="o">);</span></div><div class='line' id='LC18'>&nbsp;&nbsp;<span class="k">return</span> <span class="k">new</span> <span class="nf">ModelAndView</span><span class="o">(</span><span class="s">&quot;xmlView&quot;</span><span class="o">,</span> <span class="n">BindingResult</span><span class="o">.</span><span class="na">MODEL_KEY_PREFIX</span></div><div class='line' id='LC19'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">+</span> <span class="s">&quot;constellations&quot;</span><span class="o">,</span> <span class="n">constellation</span><span class="o">);</span></div><div class='line' id='LC20'><span class="o">}</span></div><div class='line' id='LC21'>&nbsp;</div><div class='line' id='LC22'><span class="nd">@RequestMapping</span><span class="o">(</span><span class="s">&quot;/constellations_by_search/{search}&quot;</span><span class="o">)</span></div><div class='line' id='LC23'><span class="kd">public</span> <span class="n">ModelAndView</span> <span class="n">findConstellationByCodeOrName</span></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nd">@PathVariable</span> <span class="n">String</span> <span class="n">search</span><span class="o">)</span> <span class="o">{</span></div><div class='line' id='LC25'>&nbsp;&nbsp;<span class="k">return</span> <span class="k">new</span> <span class="nf">ModelAndView</span><span class="o">(</span><span class="s">&quot;xmlView&quot;</span><span class="o">,</span> <span class="n">BindingResult</span><span class="o">.</span><span class="na">MODEL_KEY_PREFIX</span></div><div class='line' id='LC26'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="o">+</span> <span class="s">&quot;constellations&quot;</span><span class="o">,</span> <span class="n">service</span><span class="o">.</span><span class="na">findAllConstellationByCodeOrName</span><span class="o">(</span><span class="n">search</span><span class="o">));</span></div><div class='line' id='LC27'><span class="o">}</span></div><div class='line' id='LC28'><br/></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/6fa57ccb22c6e9411ab35b66c6e63bb88d1406bb/ConstellationServiceController.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_constellation_service_controller.java" style="float:right;margin-right:10px;color:#666">ConstellationServiceController.java</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The last step we need to do is to configure the Spring container to get it together. For this we need a little bit XML. In this XML we configure 2 views: one for a XML and one for a JSON response. So you need to add the xml or json extension to the url to control the format of the response.</p>
<div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nt">&lt;bean</span> <span class="na">class=</span><span class="s">&quot;org.springframework.web.servlet.view.BeanNameViewResolver&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC2'>&nbsp;</div><div class='line' id='LC3'><span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;xstreamMarshaller&quot;</span> <span class="na">class=</span><span class="s">&quot;org.springframework.oxm.xstream.XStreamMarshaller&quot;</span></div><div class='line' id='LC4'><span class="na">p:autodetectAnnotations=</span><span class="s">&quot;true&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC5'>&nbsp;</div><div class='line' id='LC6'><span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;xmlView&quot;</span> <span class="na">class=</span><span class="s">&quot;org.springframework.web.servlet.view.xml.MarshallingView&quot;</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="na">p:contentType=</span><span class="s">&quot;application/xml&quot;</span><span class="nt">&gt;</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;constructor-arg</span> <span class="na">ref=</span><span class="s">&quot;xstreamMarshaller&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC9'><span class="nt">&lt;/bean&gt;</span></div><div class='line' id='LC10'>&nbsp;</div><div class='line' id='LC11'><span class="nt">&lt;bean</span> <span class="na">id=</span><span class="s">&quot;jsonView&quot;</span> <span class="na">class=</span><span class="s">&quot;org.springframework.web.servlet.view.json.MappingJacksonJsonView&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC12'>&nbsp;</div><div class='line' id='LC13'><span class="nt">&lt;bean</span> <span class="na">class=</span><span class="s">&quot;org.springframework.web.servlet.view.ContentNegotiatingViewResolver&quot;</span><span class="nt">&gt;</span></div><div class='line' id='LC14'>&nbsp;&nbsp;<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;mediaTypes&quot;</span><span class="nt">&gt;</span></div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;map&gt;</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;entry</span> <span class="na">key=</span><span class="s">&quot;json&quot;</span> <span class="na">value=</span><span class="s">&quot;application/json&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;entry</span> <span class="na">key=</span><span class="s">&quot;xml&quot;</span> <span class="na">value=</span><span class="s">&quot;application/xml&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;/map&gt;</span></div><div class='line' id='LC19'>&nbsp;&nbsp;<span class="nt">&lt;/property&gt;</span></div><div class='line' id='LC20'>&nbsp;&nbsp;<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;defaultViews&quot;</span><span class="nt">&gt;</span></div><div class='line' id='LC21'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;list&gt;</span></div><div class='line' id='LC22'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;ref</span> <span class="na">bean=</span><span class="s">&quot;jsonView&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC23'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;ref</span> <span class="na">bean=</span><span class="s">&quot;xmlView&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC24'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;/list&gt;</span></div><div class='line' id='LC25'>&nbsp;&nbsp;<span class="nt">&lt;/property&gt;</span></div><div class='line' id='LC26'>&nbsp;&nbsp;<span class="nt">&lt;property</span> <span class="na">name=</span><span class="s">&quot;ignoreAcceptHeader&quot;</span> <span class="na">value=</span><span class="s">&quot;true&quot;</span> <span class="nt">/&gt;</span></div><div class='line' id='LC27'><span class="nt">&lt;/bean&gt;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/66ec721d1fa99709925728bdeb7ea76f9d97b1da/rpc-context.xml" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_rpc_context.xml" style="float:right;margin-right:10px;color:#666">rpc-context.xml</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>First we configure the XMLMarshaller to generate XML out of the Java beans. Then we need 2 Views. One for XML and one for JSON. The most configuration needs the <em>ContentNegotiatingViewResolver</em>. This resolver handles the different response formats. The last property <em>ignoreAcceptHeader</em> you need to get JSON in your browser too. Otherwise always XML will be returned.</p>
<h4>Configuring the web.xml</h4>
<p>You need to activate the Spring servlet and the context listener to get the service running. This is done with a small web.xml.</p>
<div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nt">&lt;web-app&gt;</span></div><div class='line' id='LC2'>&nbsp;&nbsp;<span class="nt">&lt;context-param&gt;</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;param-name&gt;</span>contextConfigLocation<span class="nt">&lt;/param-name&gt;</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;param-value&gt;</span>/WEB-INF/rpc-servlet.xml<span class="nt">&lt;/param-value&gt;</span></div><div class='line' id='LC5'>&nbsp;&nbsp;<span class="nt">&lt;/context-param&gt;</span></div><div class='line' id='LC6'>&nbsp;</div><div class='line' id='LC7'>&nbsp;&nbsp;<span class="nt">&lt;listener&gt;</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;listener-class&gt;</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;org.springframework.web.context.ContextLoaderListener</div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;/listener-class&gt;</span></div><div class='line' id='LC11'>&nbsp;&nbsp;<span class="nt">&lt;/listener&gt;</span></div><div class='line' id='LC12'>&nbsp;</div><div class='line' id='LC13'>&nbsp;&nbsp;<span class="nt">&lt;servlet&gt;</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;servlet-name&gt;</span>rpc<span class="nt">&lt;/servlet-name&gt;</span></div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;servlet-class&gt;</span>org.springframework.web.servlet.DispatcherServlet<span class="nt">&lt;/servlet-class&gt;</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;load-on-startup&gt;</span>1<span class="nt">&lt;/load-on-startup&gt;</span></div><div class='line' id='LC17'>&nbsp;&nbsp;<span class="nt">&lt;/servlet&gt;</span></div><div class='line' id='LC18'>&nbsp;</div><div class='line' id='LC19'>&nbsp;&nbsp;<span class="nt">&lt;servlet-mapping&gt;</span></div><div class='line' id='LC20'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;servlet-name&gt;</span>rpc<span class="nt">&lt;/servlet-name&gt;</span></div><div class='line' id='LC21'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;url-pattern&gt;</span>/rpc/*<span class="nt">&lt;/url-pattern&gt;</span></div><div class='line' id='LC22'>&nbsp;&nbsp;<span class="nt">&lt;/servlet-mapping&gt;</span></div><div class='line' id='LC23'><span class="nt">&lt;/web-app&gt;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/9ab96c4e6c65efa26201dbec2b92fefa075dccd4/web.xml" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_web.xml" style="float:right;margin-right:10px;color:#666">web.xml</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>Now we have all together and can start the web application. You can access the services with <em>http://localhost:8080/rpc/constellations</em>. As default format XML will be returned. If you want to have JSON change the URL into <em>http://localhost:8080/rpc/constellations.json</em>. Of course you can add .xml to get XML output, too.</p>
<p>If you want to have the data for one constellation you can use the 2nd controller method with <em>http://localhost:8080/rpc/constellation_by_code/and</em>. The last part of the URL is the official code/abbreviation of a constellation. All codes/abbreviations you can get <a title="List of all 88 constellations" href="http://en.wikipedia.org/wiki/List_of_constellations" target="_blank">here</a>. If you want the output as JSON you can add the extension <em>.json</em> too: <em>http://localhost:8080/rpc/constellation_by_code/and.json</em></p>
<h4>Optimize the output</h4>
<p>We have even 2 little problems:</p>
<ol>
<li>The Constellation class defines a byte array containing imagedata of a starcard. If we want to retrieve all constellations the response will be great.</li>
<li>The association will not be resolved. We want to get all names of a constellation with one request to minimize the response-request cycle.</li>
</ol>
<div><span class="Apple-style-span" style="line-height: 18px;">For the marshalling between XML and JAVA code we use <a title="More about XStream" href="http://xstream.codehaus.org/" target="_blank">XStream</a>. With this library you can (de-)serialize XML from Java and vice versa. With XStream you can add an annotation to a class property to avoid the serialization. This annotation is named <em>XStreamOmmitField</em>.</span></div>
<div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Constellation</span><span class="o">{</span></div><div class='line' id='LC2'>&nbsp;&nbsp;<span class="o">...</span></div><div class='line' id='LC3'>&nbsp;&nbsp;<span class="nd">@XStreamOmmitField</span></div><div class='line' id='LC4'>&nbsp;&nbsp;<span class="kd">private</span> <span class="kt">byte</span><span class="o">[]</span> <span class="n">starCardData</span><span class="o">;</span></div><div class='line' id='LC5'><span class="o">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/aed60984f7413c64cc36e146989702a41f703672/Constellation.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_constellation.java" style="float:right;margin-right:10px;color:#666">Constellation.java</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
<br />
The 2nd problem can be solved with the @XStreamImplicit annotation. The collection will be resolved and ebedded in the return data. Additionally you can set the name of the parent element of the collection in the XML data.</p>
<p><div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Constellation</span><span class="o">{</span></div><div class='line' id='LC2'><span class="o">...</span></div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'><span class="nd">@XStreamImplicit</span><span class="o">(</span><span class="n">itemFiledName</span> <span class="o">=</span> <span class="s">&quot;names&quot;</span><span class="o">)</span></div><div class='line' id='LC5'><span class="kd">private</span> <span class="n">List</span><span class="o">&lt;</span><span class="n">ConstellationName</span><span class="o">&gt;</span> <span class="n">names</span><span class="o">;</span></div><div class='line' id='LC6'><span class="o">}</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/519354ad901c69e597a058ea19ffd3a2f695fd2c/Constellation1.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_constellation1.java" style="float:right;margin-right:10px;color:#666">Constellation1.java</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>The XML result should look like</p>
<div id="gist-1289371" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nt">&lt;constallation&gt;</span></div><div class='line' id='LC2'>&nbsp;&nbsp;<span class="nt">&lt;id&gt;</span>4<span class="nt">&lt;/id&gt;</span></div><div class='line' id='LC3'>&nbsp;&nbsp;<span class="nt">&lt;name&gt;</span>Andromeda<span class="nt">&lt;/name&gt;</span></div><div class='line' id='LC4'>&nbsp;&nbsp;<span class="nt">&lt;code&gt;</span>and<span class="nt">&lt;/code&gt;</span></div><div class='line' id='LC5'>&nbsp;&nbsp;...</div><div class='line' id='LC6'>&nbsp;&nbsp;<span class="nt">&lt;names&gt;</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;id&gt;</span>19<span class="nt">&lt;/id&gt;</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;name&gt;</span>Andromeda<span class="nt">&lt;/name&gt;</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;langCode&gt;</span>de<span class="nt">&lt;/langCode&gt;</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;code&gt;</span>and<span class="nt">&lt;/code&gt;</span></div><div class='line' id='LC11'>&nbsp;&nbsp;<span class="nt">&lt;/names&gt;</span></div><div class='line' id='LC12'>&nbsp;&nbsp;<span class="nt">&lt;names&gt;</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;id&gt;</span>20<span class="nt">&lt;/id&gt;</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;name&gt;</span>Andromeda<span class="nt">&lt;/name&gt;</span></div><div class='line' id='LC15'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;langCode&gt;</span>en<span class="nt">&lt;/langCode&gt;</span></div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;code&gt;</span>and<span class="nt">&lt;/code&gt;</span></div><div class='line' id='LC17'>&nbsp;&nbsp;<span class="nt">&lt;/names&gt;</span></div><div class='line' id='LC18'>&nbsp;&nbsp;...</div><div class='line' id='LC19'><span class="nt">&lt;/constellation&gt;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1289371/be6d663022d3dba800bce32c13dd31e134c1792c/result.xml" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1289371#file_result.xml" style="float:right;margin-right:10px;color:#666">result.xml</a>
            <a href="https://gist.github.com/1289371">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<h4>Conclusion</h4>
<p>Now you have a Spring-based RESTful service created. As you can see there are not many code you must write. The most is configuration with annotation and some XML. With the @RequestMapping you can create powerful mappings from URL resources to controller methods. Another nice feature is to deliver the response as XML and JSON.</p>
<h4>Resources</h4>
<address>You will find all the code snippets at <a title="All the code snippets of this article" href="https://gist.github.com/1289371" target="_blank">https://gist.github.com/1289371</a></address>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2011/10/15/creating-restful-webservices-with-the-spring-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vortragsreihe Dortmund 15.03.2010: Spring 3 &#8211; Der dritte Frühling</title>
		<link>http://www.thorsten-kamann.de/2010/03/05/vortragsreihe-dortmund-15-03-2010-spring-3-der-dritte-fruhling/</link>
		<comments>http://www.thorsten-kamann.de/2010/03/05/vortragsreihe-dortmund-15-03-2010-spring-3-der-dritte-fruhling/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 09:29:00 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring MVC]]></category>
		<category><![CDATA[Spring Roo]]></category>
		<category><![CDATA[SpringSource ToolSuite]]></category>

		<guid isPermaLink="false">http://blog.kamann.info/?p=277</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2010/03/05/vortragsreihe-dortmund-15-03-2010-spring-3-der-dritte-fruhling/" title="Vortragsreihe Dortmund 15.03.2010: Spring 3 - Der dritte Frühling"></a>»Spring 3« ist da. Vieles ist geblieben, manches verschwunden, manches neu. Spring 3 verspricht eine verbesserte und dynamischere  Konfiguration, einen leistungsfähigen und mächtigen REST-Support und viele kleine Verbesserungen. Parallel zu dem Spring 3-Release wurden auch andere Tools und Projekte aktualisiert, &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2010/03/05/vortragsreihe-dortmund-15-03-2010-spring-3-der-dritte-fruhling/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2010/03/05/vortragsreihe-dortmund-15-03-2010-spring-3-der-dritte-fruhling/" title="Vortragsreihe Dortmund 15.03.2010: Spring 3 - Der dritte Frühling"></a><p>»Spring 3« ist da. Vieles ist geblieben, manches verschwunden, manches neu. Spring 3 verspricht eine verbesserte und dynamischere  Konfiguration, einen leistungsfähigen und mächtigen REST-Support und viele kleine Verbesserungen. Parallel zu dem Spring 3-Release wurden auch andere Tools und Projekte aktualisiert, auf die wir ebenfalls einen Blick werfen wollen:</p>
<ul>
<li>Wichtige Änderungen</li>
<li>Java Configuration</li>
<li>Spring Expression Language</li>
<li>Spring MVC und Rest</li>
<li>Embedded Database</li>
<li>SpringSource Toolsuite</li>
<li>Spring Roo</li>
<li>Grails</li>
</ul>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=3449158&amp;doc=spring3-2-live-100316162037-phpapp02" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=3449158&amp;doc=spring3-2-live-100316162037-phpapp02" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355" wmode="transparent"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2010/03/05/vortragsreihe-dortmund-15-03-2010-spring-3-der-dritte-fruhling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vortragsreihe Bonn 22.02.2010: Spring 3 &#8211; Der dritte Frühling</title>
		<link>http://www.thorsten-kamann.de/2010/02/14/vortragsreihe-bonn-22-02-2010-spring-3-der-dritte-fruhling/</link>
		<comments>http://www.thorsten-kamann.de/2010/02/14/vortragsreihe-bonn-22-02-2010-spring-3-der-dritte-fruhling/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 20:09:25 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Grails]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring Roo]]></category>
		<category><![CDATA[SpringSource ToolSuite]]></category>
		<category><![CDATA[sts]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/wordpress/?p=263</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2010/02/14/vortragsreihe-bonn-22-02-2010-spring-3-der-dritte-fruhling/" title="Vortragsreihe Bonn 22.02.2010: Spring 3 - Der dritte Frühling"></a>»Spring 3« ist da. Vieles ist geblieben, manches verschwunden, manches neu. Dieser Vortrag beleuchtet die Änderungen und zeigt wie man die neuen Features einsetzen kann. Zusätzlich werfen wir gemeinsam einen Blick auf die SpringSource Toolsuite, Spring Roo, Grails.]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2010/02/14/vortragsreihe-bonn-22-02-2010-spring-3-der-dritte-fruhling/" title="Vortragsreihe Bonn 22.02.2010: Spring 3 - Der dritte Frühling"></a><p>»Spring 3« ist da. Vieles ist geblieben, manches verschwunden, manches neu. Dieser Vortrag beleuchtet die Änderungen und zeigt wie man die neuen Features einsetzen kann.</p>
<p>Zusätzlich werfen wir gemeinsam einen Blick auf die SpringSource Toolsuite, Spring Roo, Grails.</p>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=3282029&amp;doc=spring3-1c-100226021429-phpapp01" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=3282029&amp;doc=spring3-1c-100226021429-phpapp01" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355" wmode="transparent"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2010/02/14/vortragsreihe-bonn-22-02-2010-spring-3-der-dritte-fruhling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Domainobjects with Spring and AOP</title>
		<link>http://www.thorsten-kamann.de/2009/11/05/using-domainobjects-with-spring-and-aop/</link>
		<comments>http://www.thorsten-kamann.de/2009/11/05/using-domainobjects-with-spring-and-aop/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 12:05:40 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Publications]]></category>
		<category><![CDATA[AOP]]></category>
		<category><![CDATA[Domain Driven Design]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/wordpress/?p=243</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2009/11/05/using-domainobjects-with-spring-and-aop/" title="Using Domainobjects with Spring and AOP"></a>This article is about the managing of Domainobjects with the Spring Framework. Domainobjects are often initilized with the new keyword. This avoids the usage with Spring, because there aren&#8217;t Spring Beans. But with AOP and the @Configurable Annotation of Spring &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2009/11/05/using-domainobjects-with-spring-and-aop/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2009/11/05/using-domainobjects-with-spring-and-aop/" title="Using Domainobjects with Spring and AOP"></a><p>This article is about the managing of Domainobjects with the Spring Framework. Domainobjects are often initilized with the new keyword. This avoids the usage with Spring, because there aren&#8217;t Spring Beans. But with AOP and the @Configurable Annotation of Spring you can manage these objects too.</p>
<p>This article is in german and published at <a href="http://it-republik.de/jaxenter/" target="_blank">Jaxenter</a>.<br />
You will find them here: <a href="http://it-republik.de/jaxenter/artikel/Mit-Spring-und-AOP-Domaenenklassen-verwalten-2644.html" target="_blank">http://it-republik.de/jaxenter/artikel/Mit-Spring-und-AOP-Domaenenklassen-verwalten-2644.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2009/11/05/using-domainobjects-with-spring-and-aop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webtests Reloaded &#8211; Webtests with Selenium, TestNG, Groovy and Maven</title>
		<link>http://www.thorsten-kamann.de/2009/05/25/vortragsreihe-bonn-250509-webtests-reloaded-webtests-mit-selenium-testng-groovy-und-maven/</link>
		<comments>http://www.thorsten-kamann.de/2009/05/25/vortragsreihe-bonn-250509-webtests-reloaded-webtests-mit-selenium-testng-groovy-und-maven/#comments</comments>
		<pubDate>Mon, 25 May 2009 21:18:02 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Selenium]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[TestNG]]></category>
		<category><![CDATA[Unittest]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/wordpress/?p=91</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2009/05/25/vortragsreihe-bonn-250509-webtests-reloaded-webtests-mit-selenium-testng-groovy-und-maven/" title="Webtests Reloaded - Webtests with Selenium, TestNG, Groovy and Maven"></a>Testdriven Development is a must-have if you want to have high quality in your project. The most difficult part you can test is the WebUI. There are many tools to support you in testing UIs. But mostly they are expensive &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2009/05/25/vortragsreihe-bonn-250509-webtests-reloaded-webtests-mit-selenium-testng-groovy-und-maven/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2009/05/25/vortragsreihe-bonn-250509-webtests-reloaded-webtests-mit-selenium-testng-groovy-und-maven/" title="Webtests Reloaded - Webtests with Selenium, TestNG, Groovy and Maven"></a><div class="entry">
<p>Testdriven Development is a must-have if you want to have high quality in your project. The most difficult part you can test is the WebUI. There are many tools to support you in testing UIs. But mostly they are expensive and difficult to use. But there is a light&#8230;</p>
<p>Selenium is started to simplify the test of WebUI. But Selenium as standalone is not fully automated. This talk describes how to automate the test of WebUI.</p>
<p><span style="color: #000000;"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=1498070&amp;doc=webtestsreloadedv2-090527170800-phpapp01" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=1498070&amp;doc=webtestsreloadedv2-090527170800-phpapp01" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355" wmode="transparent"></embed></object></span></p>
<p><span style="color: #000000;"><strong>Interesting links:</strong></span></p>
<ul style="text-align: left;">
<li><a title="Selenium" href="http://seleniumhq.org/" target="_blank"><span style="color: #000000;">Selenium</span></a></li>
<li><a title="Groovy" href="http://groovy.codehaus.org" target="_blank"><span style="color: #000000;">Groovy</span></a></li>
<li><a title="TestNG" href="http://www.testng.org/" target="_blank"><span style="color: #000000;">TestNG</span></a></li>
<li><span style="color: #000000;"><a title="Maven" href="http://maven.apache.org" target="_blank">Maven</a><br />
</span></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2009/05/25/vortragsreihe-bonn-250509-webtests-reloaded-webtests-mit-selenium-testng-groovy-und-maven/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Modularizing of Software with Spring dm</title>
		<link>http://www.thorsten-kamann.de/2009/03/23/geschnitten-oder-am-stuck-modularisierung-von-software-mir-spring-dynamic-modules/</link>
		<comments>http://www.thorsten-kamann.de/2009/03/23/geschnitten-oder-am-stuck-modularisierung-von-software-mir-spring-dynamic-modules/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 19:37:27 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Publications]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring dm]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[Unit]]></category>
		<category><![CDATA[Unittest]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/wordpress/?p=120</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2009/03/23/geschnitten-oder-am-stuck-modularisierung-von-software-mir-spring-dynamic-modules/" title="Modularizing of Software with Spring dm"></a>EclipseMagazin 03.09 with Dmytro Mayster, itemis AG This article shows how to modularize existing software in different ways. The first one use pure OSGi. With the second try the modularization will be done with Spring dm. This article is written &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2009/03/23/geschnitten-oder-am-stuck-modularisierung-von-software-mir-spring-dynamic-modules/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2009/03/23/geschnitten-oder-am-stuck-modularisierung-von-software-mir-spring-dynamic-modules/" title="Modularizing of Software with Spring dm"></a><div class="entry">
<h6>EclipseMagazin 03.09 with <a href="https://www.xing.com/profile/Dmytro_Mayster">Dmytro Mayster</a>,<a href="http://www.itemis.de/"> itemis AG</a></h6>
<p>This article shows how to modularize existing software in different ways. The first one use pure OSGi. With the second try the modularization will be done with Spring dm.</p>
<p>This article is written german. If you can read german here is the original abstract:</p>
<h3>Geschnitten oder am Stück? &#8211; Modularisierung von Software mir Spring Dynamic-Modules</h3>
<p>Bob D. Veloper schlägt die Hände über dem Kopf zusammen. Schon wieder ist der Build fehlgeschlagen. Und schon wieder wurden interne Klassen der Adresskomponente von der Customerkomponente verwendet. Dieser Vorfall bewegt Bob dazu dieses Thema genauer anzugehen und zu lösen.<br />
Dieser Artikel beschreibt den Weg von Bob D. Veloper, den er nimmt, um seine Software zu OSGI-fien.</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2009/03/23/geschnitten-oder-am-stuck-modularisierung-von-software-mir-spring-dynamic-modules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vortragsreihe Bonn 18.07.2008: My daily Spring &#8211; Best Practices mit Spring</title>
		<link>http://www.thorsten-kamann.de/2008/07/18/vortragsreihe-bonn-my-daily-spring-best-practices-mit-spring/</link>
		<comments>http://www.thorsten-kamann.de/2008/07/18/vortragsreihe-bonn-my-daily-spring-best-practices-mit-spring/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 20:44:31 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[Unit]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/wordpress/?p=83</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2008/07/18/vortragsreihe-bonn-my-daily-spring-best-practices-mit-spring/" title="Vortragsreihe Bonn 18.07.2008: My daily Spring - Best Practices mit Spring"></a>In vielen Projekten ist das Spring-Framework das Mittel der Wahl. Zusätzlich werden in vielen Produkten Spring intern eingesetzt. Damit die Arbeit mit Spring uneingeschränkt Spass macht ist es wichtig einige Tricks und Kniffe zu kennen. In diesem Vortrag zeigt Ihnen &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2008/07/18/vortragsreihe-bonn-my-daily-spring-best-practices-mit-spring/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2008/07/18/vortragsreihe-bonn-my-daily-spring-best-practices-mit-spring/" title="Vortragsreihe Bonn 18.07.2008: My daily Spring - Best Practices mit Spring"></a><p>In vielen Projekten ist das <a id="amzn_cl_link_0" style="border-bottom: 1px solid; color: #aa3511; text-decoration: underline; padding-bottom: 1px;" name="0764574833" href="http://amazon.de/gp/product/0764574833?ie=UTF8&amp;tag=thorskaman-21&amp;link_code=em1&amp;camp=2510&amp;creative=11146&amp;creativeASIN=0764574833&amp;adid=0f832feb-cf5f-4e31-badb-c1927afb0c4d" target="_blank">Spring-Framework</a> das Mittel der Wahl. Zusätzlich werden in vielen Produkten Spring intern eingesetzt. Damit die Arbeit mit Spring uneingeschränkt Spass macht ist es wichtig einige Tricks und Kniffe zu kennen. In diesem Vortrag zeigt Ihnen der Referent, wie Sie effektiv Spring in Ihren Projekten einsetzen können. Die Themenbandbreite reicht dabei vom Tooling über Architekturthemen bis hin zum Testing:</p>
<ul>
<li>Spring-IDE: Features und Verwendung
<ul>
<li>Navigation zwischen Beandefinitionen und Code</li>
<li>Aspekte</li>
</ul>
</li>
<li>Architekturen unabhängig von Spring
<ul>
<li>keine HibernateTemplates</li>
<li>mein Code kennt nur Standards</li>
<li>eigene Annotations anstatt Spring-Annotations</li>
</ul>
</li>
<li>Testen mit Spring
<ul>
<li>Spring für Unittests</li>
<li>Dependency Injection</li>
<li>Angepasste Spring-Konfigurationen</li>
<li>DAO-Test</li>
</ul>
</li>
</ul>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=532860&amp;doc=mydailyspring-1217328085126960-9" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=532860&amp;doc=mydailyspring-1217328085126960-9" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355" wmode="transparent"></embed></object></p>
<p><img id="kosa-target-image" style="position: absolute; visibility: hidden; z-index: 2147483647; left: 434px; top: 302px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAUCAYAAACJfM0wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAAB90RVh0U29mdHdhcmUATWFjcm9tZWRpYSBGaXJld29ya3MgOLVo0ngAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDQvMDQvMDhrK9wWAAACA0lEQVQ4jbXVz0sUYRjA8e+u6xqlKJUaBZuUh6AfhyCEpUN/QIR0skMh6iHwsKe6lFu4HjpJhy5BS1CsZtDSrYMYdPHUZauDbhcpi7bEH2DOtjvP83aY3dFxxi1hfeAd3nlhPu/zPjPvOyHgKnsQEQDz60kaaKuTuRpqHxqMAKBWvVCoJOjAxqqj60Q1Y3fg05dWki/OMjt3+L+A+KklRvs+cia2VhtOTsYpN5wgl4nReTCM6s7o96UyA6kFkpNK9tZMEFx0B2bnO8hlYky/L5N9V2TDsinbgohi207fFqGxwZDoO0T67nEu9FseAyAMODWuNqC9LczUTBGrKIgqqgYRQdSgqogovy2b8YkCxzqiBBlOxuJ/earqIqqKbMfVsLYuGGMIMnb8KkTUk60HNwapTOqGCYLVDzdGDH9Km1mKiDOBMe4qmqJbl+g1wu5gtQGFZWHw8gFam/GXoILubwpxf+go336WCDJ8pYh35xkYayZ9J8aVi52+lZgt18VCif7RBeLd+X+XItX7nJHXyvkb6wD8eHOOqekVEuNffZM4icyR6s34SuGDTx/Jk715D4CTIy959XaFB0/n+Tw2TMu+jUDcMby3vg2yPW4/WuTxtYe0RJd9D9eKmodQT1eOxKVn9HR9qJZ1l3DABgGYuD7sdGR36CZsrFXqeNADhNijX9NfAyI+Sz1Sug0AAAAASUVORK5CYII=" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2008/07/18/vortragsreihe-bonn-my-daily-spring-best-practices-mit-spring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spring and Annotations</title>
		<link>http://www.thorsten-kamann.de/2008/03/29/spring-and-annotations/</link>
		<comments>http://www.thorsten-kamann.de/2008/03/29/spring-and-annotations/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 22:16:32 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Posts]]></category>
		<category><![CDATA[Annotation]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JPA]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/wordpress/?p=15</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2008/03/29/spring-and-annotations/" title="Spring and Annotations"></a>The Spring-Framework is a non-invasive framework. This means you can develop pure POJOs without any dependencies to the framework. You don&#8217;t need implement any interface nor you need to extend any base classes. However there are a lot of useful &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2008/03/29/spring-and-annotations/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2008/03/29/spring-and-annotations/" title="Spring and Annotations"></a><p>The Spring-Framework is a non-invasive framework. This means you can develop pure POJOs without any dependencies to the framework. You don&#8217;t need implement any interface nor you need to extend any base classes. However there are a lot of useful classes and interfaces provided by Spring &#8211; do you know the HibernateTemplate? &#8211; so you can use them if you want but you aren&#8217;t forced to use them.</p>
<p>If you remember the Spring 1.x stream without use of these templates make it very difficult to implement DAOs. This is much better with Spring 2 and JPA. For now you need only to inject an EntityManager and use the methods of them. That&#8217;s very nice, because of the EntityManager is a class out of the JPA/EJB3 standard.</p>
<p>Since Spring 2 there are annotation support. Not only standardized annotations are supported. Spring provides his own annotations. This is not so nice, because the use of this annotations makes your PoJos depend on Spring.</p>
<p><span id="more-15"></span></p>
<h3>The Sample</h3>
<p>There are a sample project to this article. You can download it <a title="Download the sample" href="http://www.thorsten-kamann.de/files/samples/sping-annotations/spring-annotations.zip">here</a>. The sample is an Eclipse Project. You need at least 3 plugins to get the sample running:</p>
<ul>
<li>SpringIDE (<a title="SpringIDE" href="http://springide.org/updatesite" target="_blank">http://springide.org/updatesite</a>)</li>
<li>GroovyIDE (<a title="GroovyIDE" href="http://dist.codehaus.org/groovy/distributions/update/" target="_blank">http://dist.codehaus.org/groovy/distributions/update/</a>)</li>
<li>Maven Integration (<a title="Maven Integration" href="http://m2eclipse.sonatype.org/update/" target="_blank">http://m2eclipse.sonatype.org/update/</a>)</li>
</ul>
<p>Additional to these plugins it is recommend to install a native Maven from <a title="Apache Maven" href="http://maven.apache.org" target="_blank">http://maven.apache.org</a>. The embedded Maven of the Maven Integration sometimes have problems with Groovy-based tests. To enable another Maven Installation you can add it in the Preferences (<span style="font-family: courier new,courier;">Window -&gt; Preferences -&gt; Maven -&gt; Installations</span>). After you have prepared your Eclipse you can import the sample and run it with <span style="font-family: courier new,courier;">Run As -&gt; Maven install</span>.</p>
<h3>Spring and Annotations</h3>
<p>Spring supports a lot of annotations. Additional to the standard Java 6 annotations like (<span style="font-family: courier new,courier;">@Resource</span>, <span style="font-family: courier new,courier;">@PostConstruct</span>, <span style="font-family: courier new,courier;">@PreDestroy</span>,&#8230;) there are a number of Spring-Annotations:</p>
<ul>
<li>@Autowired &#8211; injets a resource byType or byName</li>
<li>@Required &#8211; marks a property as mandatory</li>
<li>@Component &#8211; marks a class as Component. This you need for <span style="font-family: courier new,courier;">@Resource</span>, <span style="font-family: courier new,courier;">@Autowired</span></li>
<li>@Service &#8211; similar to <span style="font-family: courier new,courier;">@Component</span></li>
<li>@Controller &#8211; marks a class as Controller for <a title="SpringMVC" href="http://static.springframework.org/spring/docs/2.0.x/reference/mvc.html" target="_blank">SpringMVC</a></li>
<li>&#8230;</li>
</ul>
<p>If you want to use dependency injection with annotations you can</p>
<pre lang="java">package testprojects.spring.annotations;

import javax.annotations.Resource;

public class Demo{
  @Resource(name="otherResource")
  private Other resource;
}</pre>
<p>In this case the Java field named with resource should get a reference to another bean with the symbolic name otherResource. To get this work you must define a bean with this symbolic name:</p>
<pre lang="java">import org.springframework.stereotype;

@Component("otherResource")
public class Other{}</pre>
<p>Now we have configured our classes with annotations. But Spring doesn&#8217;t know that he should scan our classes for annotations. This we can do with the element <span style="font-family: courier new,courier;">context:component-scan</span> in an <span style="font-family: courier new,courier;">applicationContext.xml</span>:</p>
<p>At the start of the ApplicationContext of Spring all classes in the package <span style="font-family: courier new,courier;">testprojects.spring.annotations</span> will be scanned for annotations. If Spring found any the context will be build &#8211; similar to the <span style="font-family: courier new,courier;">XmlApplicationContext</span></p>
<p>.</p>
<h3>The Problem</h3>
<p>If you take a closer look at the class <span style="font-family: courier new,courier;">Other </span>you will see the import of¬† <span style="font-family: courier new,courier;">org.springframework.stereotype</span>. This will make the class depend to the Spring Framework. Thats very bad, because we won&#8217;t have such a dependency. But what we can do?  The solution is quite simple. Let us define our own annotation for this case and re-configure Spring in that way that our annotation instead teh Spring one will be used to mark classes as <span style="font-family: courier new,courier;">Components</span>.  The definition of the annotation is simple and a one-to-one copy of the original annotation provided by Spring:</p>
<pre lang="java">package testprojects.spring.annotations;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springframework.stereotype.Repository;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Component {

  /**
  * The value may indicate a suggestion for a logical component name, to be
  * turned into a Spring bean in case of an autodetected component.
  *
  * @return the suggested component name, if any
  */
  String value() default "";
}</pre>
<p>The next step is to tell Spring that he doesn&#8217;t use its own <span style="font-family: courier new,courier;">@Component</span>-Annotation but our annotation. This can do with the <span style="font-family: courier new,courier;">context:component-scan</span> element, too:</p>
<p>The important changes are the attribute<span style="font-family: courier new,courier;"> use-default-filters</span>. If you set this to false, Spring ommit his own annotations. In this case you can define you own annotation classes with the c<span style="font-family: courier new,courier;">ontext:include-filter</span> element.</p>
<h3>And now&#8230; a sample</h3>
<p>Now we want it get together. To demonstrate the mechnism we want to create an own Annotation as replacement for the Spring @Service-Annotation. Then we mark a PoJo with this annotation and write a Unittest to verify that Spring use this class as Spring-Bean.</p>
<h4>1. Create the Service-Annotation</h4>
<pre lang="java">package testprojects.spring.annotations.Service;

@Target( { ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface MyService {

  /**
  * The value may indicate a suggestion for a logical component name, to be
  * turned into a Spring bean in case of an autodetected component.
  *
  * @return the suggested component name, if any
  */
  String value() default "";
}</pre>
<h4>2. Add this annotation to our class</h4>
<pre lang="java">import testprojects.spring.annotations.Service;

@MyService
public class ServiceBean {

}</pre>
<h4>3. Re-configure Spring to use the @MyService-Annotation</h4>
<pre lang="xml">&lt;beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:p="http://www.springframework.org/schema/p"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;

   &lt;context:component-scan
     base-package="testprojects.spring.annotations" use-default-filters="false"&gt;
     &lt;context:include-filter
         expression="testprojects.spring.annotations.Service"
         type="annotation" /&gt;
    &lt;/context:component-scan&gt;
&lt;/beans&gt;</pre>
<h4>4. Write a Unittest to verify that Spring is using the annotated class as SpringBean</h4>
<pre lang="groovy">@RunWith(SpringJUnit4ClassRunner)
@ContextConfiguration
public class ServiceAnnotationTest{

  @Autowired
  ServiceBean serviceBean

  @Test
  final void testServiceAnnotation(){
    Assert.assertNotNull(serviceBean)
  }
}</pre>
<p>bcbcbc</p>
<p><img id="kosa-target-image" style="position: absolute; visibility: hidden; z-index: 2147483647; left: 44px; top: 2361px;" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAUCAYAAACJfM0wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAAB90RVh0U29mdHdhcmUATWFjcm9tZWRpYSBGaXJld29ya3MgOLVo0ngAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDQvMDQvMDhrK9wWAAACMElEQVQ4ja3SP2gTcRQH8O8vvUtIGmkqTY3SaMVFz6KDW2ywg4s4dGgXp3SyVLIIthCKQxCCuoZaXaSO/ilKd4sSdXRL0EWtIRYaSkXsJTH33utwSZM01xo0D353v+N+97l33/upQCAwFgwGfehiFYtFUxsYGPCmUqmv3YQTicSwBgCapnXTBQBoSinout5VVCnVDr/44B/OZH0xs6KMThCfR3LRs+aTycjvbwfCmawvduZkn7EwN4TBfheY90fXN6uYuffdyGQRu3apkmyDmzM2K8pYmBvC6kcLK+/KMEsWLCIQMSyLULUIFhH0HsGNycNYnDuO6PRno9lQSsFVh+tDQSEY6MHymzJKFQILgxkgYhALmBnMDLNsIf1sA8cG3VDYYzhFAWWfRBjCAiIbIxYQE1ga17+2GSICKLQYznCtiATEDK6BIrU5MUhgd0+NH+AIt+5jshdqgkpVwEwNkBgs9lyE4XY3nnLMWNf13QEAG1uE2JVe9PUC5JCvCMPrVpifOor1YnW34/pw7NjvVbmZ+3ljcTaMq5EjbRFJ07Gw8QfTd9fg96rc3o7bMh4f9SytvDenLl7/ZADAl5cjWF7dwmy60PaSeiPjo56lv2Ycnzi0Fp9AEgAu39x8+urtT9x5/GP74a2++LlTuumo76kDd4W9ALj9qIDIiOfBhdO+jtB9O279TFcuet77fD7Wn+sU7ajj1+kTSccb/wv/aymloEKh0Fg4HPZ2E87n86Udvs4FoWqwSHUAAAAASUVORK5CYII=" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2008/03/29/spring-and-annotations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vortragsreihe Dortmund 17.09.2007: Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy</title>
		<link>http://www.thorsten-kamann.de/2007/09/17/vortragsreihe-dortmund-17092007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/</link>
		<comments>http://www.thorsten-kamann.de/2007/09/17/vortragsreihe-dortmund-17092007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 21:39:42 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[TestNG]]></category>
		<category><![CDATA[Unit]]></category>
		<category><![CDATA[Unittest]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/wordpress/?p=104</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2007/09/17/vortragsreihe-dortmund-17092007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/" title="Vortragsreihe Dortmund 17.09.2007: Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy"></a>Gute Software sollte sich an der entsprechenden Fachdomäne orientieren und nicht an der zugrundeliegenden Technologie. Um dies zu erreichen, wird allerdings eine Basis benötigt, die technisch ausgereift ist ohne Einschränkungen für die Entwicklung. Eine solche Basis kann mit dem Springframework &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2007/09/17/vortragsreihe-dortmund-17092007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2007/09/17/vortragsreihe-dortmund-17092007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/" title="Vortragsreihe Dortmund 17.09.2007: Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy"></a><p>Gute Software sollte sich an der entsprechenden Fachdomäne orientieren und nicht an der zugrundeliegenden Technologie. Um dies zu erreichen, wird allerdings eine Basis benötigt, die technisch ausgereift ist ohne Einschränkungen für die Entwicklung. Eine solche Basis kann mit dem Springframework geschaffen werden. Die Kombination von Spring, Annotations, <a id="amzn_cl_link_1" style="border-bottom: 1px solid; color: #aa3511; text-decoration: underline; padding-bottom: 1px;" name="3446409416" href="http://amazon.de/gp/product/3446409416?ie=UTF8&amp;tag=thorskaman-21&amp;link_code=em1&amp;camp=2510&amp;creative=11146&amp;creativeASIN=3446409416&amp;adid=f166a279-fb31-4ef0-8e63-1332eac5f630" target="_blank">Java Persistence</a> (JPA) und Unit-Testing erlaubt eine flexible und modulare Architektur und könnte eine mögliche technische Basis für ein solches Softwaresystem sein.</p>
<p>Dieser Vortrag stellt einen Lösungsansatz anhand eines einfachen Beispiels vor. Die Aufbereitung der Inhalte orientiert sich dabei an einem typischen test-zentrierten Entwicklungsprozess. Folgende Themen werden angesprochen:</p>
<ul>
<li>Einleitung Spring und JPA, Maven, <a id="amzn_cl_link_4" style="border-bottom: 1px solid; color: #aa3511; text-decoration: underline; padding-bottom: 1px;" name="3897478544" href="http://amazon.de/gp/product/3897478544?ie=UTF8&amp;tag=thorskaman-21&amp;link_code=em1&amp;camp=2510&amp;creative=11146&amp;creativeASIN=3897478544&amp;adid=d8dd601f-46f5-4125-9730-1a217cf87d28" target="_blank">Groovy</a></li>
<li>Projektstruktur</li>
<li>Entwicklung der API (der Schnittstellen)</li>
<li>Test-getriebene Entwicklung der Implementierung</li>
<li>Spring-unterstützte Integrationstests</li>
</ul>
<p>Ausblick:</p>
<ul>
<li>Spring 2.5 &#8211; mehr Annotations; Verwaltung von Entities mit Spring</li>
<li>Webschicht &#8211; Anbindung einer Webanwendung mit <a id="amzn_cl_link_5" style="border-bottom: 1px solid; color: #aa3511; text-decoration: underline; padding-bottom: 1px;" name="3827321271" href="http://amazon.de/gp/product/3827321271?ie=UTF8&amp;tag=thorskaman-21&amp;link_code=em1&amp;camp=2510&amp;creative=11146&amp;creativeASIN=3827321271&amp;adid=5df766c5-929f-4ee9-8a16-845e8c067508" target="_blank">Java Server Faces</a> (JSF)</li>
<li>Spring-Webservices &#8211; Contract-First Webservices mit Spring-WS 1.0</li>
</ul>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=408896&amp;doc=lwabonn280108-1210887213630253-9" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=408896&amp;doc=lwabonn280108-1210887213630253-9" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355" wmode="transparent"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2007/09/17/vortragsreihe-dortmund-17092007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vortragsreihe Bonn 28.01.2007: Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy</title>
		<link>http://www.thorsten-kamann.de/2007/01/28/vortragsreihe-bonn-28012007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/</link>
		<comments>http://www.thorsten-kamann.de/2007/01/28/vortragsreihe-bonn-28012007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/#comments</comments>
		<pubDate>Sun, 28 Jan 2007 21:34:44 +0000</pubDate>
		<dc:creator>thorque</dc:creator>
				<category><![CDATA[Events]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Test]]></category>
		<category><![CDATA[TestNG]]></category>
		<category><![CDATA[Unit]]></category>
		<category><![CDATA[Unittest]]></category>

		<guid isPermaLink="false">http://www.thorsten-kamann.de/wordpress/?p=101</guid>
		<description><![CDATA[<a href="http://www.thorsten-kamann.de/2007/01/28/vortragsreihe-bonn-28012007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/" title="Vortragsreihe Bonn 28.01.2007: Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy"></a>Gute Software sollte sich an der entsprechenden Fachdomäne orientieren und nicht an der zugrundeliegenden Technologie. Um dies zu erreichen, wird allerdings eine Basis benötigt, die technisch ausgereift ist ohne Einschränkungen für die Entwicklung. Eine solche Basis kann mit dem Springframework &#8230;<p class="read-more"><a href="http://www.thorsten-kamann.de/2007/01/28/vortragsreihe-bonn-28012007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://www.thorsten-kamann.de/2007/01/28/vortragsreihe-bonn-28012007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/" title="Vortragsreihe Bonn 28.01.2007: Leichtgewichtige Architekturen mit Spring, JPA, Maven und Groovy"></a><p>Gute Software sollte sich an der entsprechenden Fachdomäne orientieren und nicht an der zugrundeliegenden Technologie. Um dies zu erreichen, wird allerdings eine Basis benötigt, die technisch ausgereift ist ohne Einschränkungen für die Entwicklung. Eine solche Basis kann mit dem Springframework geschaffen werden. Die Kombination von Spring, Annotations, <a id="amzn_cl_link_1" style="border-bottom: 1px solid; color: #aa3511; text-decoration: underline; padding-bottom: 1px;" name="3446409416" href="http://amazon.de/gp/product/3446409416?ie=UTF8&amp;tag=thorskaman-21&amp;link_code=em1&amp;camp=2510&amp;creative=11146&amp;creativeASIN=3446409416&amp;adid=f166a279-fb31-4ef0-8e63-1332eac5f630" target="_blank">Java Persistence</a> (JPA) und Unit-Testing erlaubt eine flexible und modulare Architektur und könnte eine mögliche technische Basis für ein solches Softwaresystem sein.</p>
<p>Dieser Vortrag stellt einen Lösungsansatz anhand eines einfachen Beispiels vor. Die Aufbereitung der Inhalte orientiert sich dabei an einem typischen test-zentrierten Entwicklungsprozess. Folgende Themen werden angesprochen:</p>
<ul>
<li>Einleitung Spring und JPA, Maven, <a id="amzn_cl_link_4" style="border-bottom: 1px solid; color: #aa3511; text-decoration: underline; padding-bottom: 1px;" name="3897478544" href="http://amazon.de/gp/product/3897478544?ie=UTF8&amp;tag=thorskaman-21&amp;link_code=em1&amp;camp=2510&amp;creative=11146&amp;creativeASIN=3897478544&amp;adid=d8dd601f-46f5-4125-9730-1a217cf87d28" target="_blank">Groovy</a></li>
<li>Projektstruktur</li>
<li>Entwicklung der API (der Schnittstellen)</li>
<li>Test-getriebene Entwicklung der Implementierung</li>
<li>Spring-unterstützte Integrationstests</li>
</ul>
<p>Ausblick:</p>
<ul>
<li>Spring 2.5 &#8211; mehr Annotations; Verwaltung von Entities mit Spring</li>
<li>Webschicht &#8211; Anbindung einer Webanwendung mit <a id="amzn_cl_link_5" style="border-bottom: 1px solid; color: #aa3511; text-decoration: underline; padding-bottom: 1px;" name="3827321271" href="http://amazon.de/gp/product/3827321271?ie=UTF8&amp;tag=thorskaman-21&amp;link_code=em1&amp;camp=2510&amp;creative=11146&amp;creativeASIN=3827321271&amp;adid=5df766c5-929f-4ee9-8a16-845e8c067508" target="_blank">Java Server Faces</a> (JSF)</li>
<li>Spring-Webservices &#8211; Contract-First Webservices mit Spring-WS 1.0</li>
</ul>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=408896&amp;doc=lwabonn280108-1210887213630253-9" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="wmode" value="transparent" /><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=id=408896&amp;doc=lwabonn280108-1210887213630253-9" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355" wmode="transparent"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thorsten-kamann.de/2007/01/28/vortragsreihe-bonn-28012007-leichtgewichtige-architekturen-mit-spring-jpa-maven-und-groovy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

