<?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>MyTekLog</title>
	<atom:link href="http://blog.konkest.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.konkest.com</link>
	<description>Carnet de notes techniques...</description>
	<lastBuildDate>Mon, 20 Jul 2009 13:26:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NetBeans 6.7 mais où sont les librairies ?</title>
		<link>http://blog.konkest.com/?p=136</link>
		<comments>http://blog.konkest.com/?p=136#comments</comments>
		<pubDate>Mon, 20 Jul 2009 13:26:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Libraries]]></category>
		<category><![CDATA[Netbeans]]></category>

		<guid isPermaLink="false">http://blog.konkest.com/?p=136</guid>
		<description><![CDATA[L&#8217;autre jour j&#8217;ai installé NetBeans 6.7 pour pouvoir tester les nouveautés et me refamiliariser avec cet environnement que j&#8217;avais pas mal délaissé pour Eclipse.

Je décide alors de suivre quelques tutoriaux pour me faire la main et appréhender la bête.
Et voilà que je me retrouve en quelques minutes bloqué avant même la première ligne de code [...]]]></description>
			<content:encoded><![CDATA[<p>L&#8217;autre jour j&#8217;ai installé NetBeans 6.7 pour pouvoir tester les nouveautés et me refamiliariser avec cet environnement que j&#8217;avais pas mal délaissé pour Eclipse.<br />
<br/><br />
Je décide alors de suivre quelques tutoriaux pour me faire la main et appréhender la bête.<br />
Et voilà que je me retrouve en quelques minutes bloqué avant même la première ligne de code ! Ces satanés tutoriaux parlent de menus contextuels de configuration que je n&#8217;ai pas ! Notamment au niveau des librairies.<br />
<br/><br />
Comment cela se fait-il ? Comment y rémédier ?<br />
<br/><br/><br />
<span id="more-136"></span></p>
<h2>Library Manager vide !</h2>
<p>Première constatation étrange : <br/><br />
Je vais dans <strong>Tools > Libraries</strong> pour ouvrir le &laquo;&nbsp;<strong>Library Manager</strong>&nbsp;&raquo; et la &#8230; RIEN !<br />
Cela est très déroutant !<br />
<br/></p>
<h3>La solution n&#8217;est pas bien compliquée:</h3>
<p>Il suffit donc de créer un nouveau projet Java par exemple : <strong>File > New Project > Java > Java Application</strong><br />
et zou&#8230; tout apparait, allez comprendre ? <br/><br />
<br/><br />
Maintenant a quoi est ce du ? Un soucis d&#8217;optimisation ? On ne charge les données que si un projet est créé ? Bref pas sorcier mais bizarre.<br />
<br/><br/>
</p>
<h2>Libraries Javascript (JQuery, MooTools et autres)</h2>
<p>Toujours a me battre avec mes tutoriaux et mes bibliothèques, je cherchais désespérément à ajouter par exemple la complétion automatique pour du JQuery.<br />
Je trouve donc des indications pour le faire : Click droit sur le projet puis choisir &laquo;&nbsp;<strong>Properties</strong>&nbsp;&raquo; et enfin sélectionner &laquo;&nbsp;<strong>Javascript Libraries</strong>&laquo;&nbsp;.<br/><br />
Voir le tuto suivant en anglais : <a href="http://www.netbeans.org/kb/docs/web/jquery-structured-document.html#settingup">Using jQuery &#8230; on NetBeans</a><br />
<br/><br />
Et bien que néni, point de menu &laquo;&nbsp;<strong>Javascript Libraries</strong>&nbsp;&raquo; sur les propriétés de mon projet !<br />
Imaginez donc ma frustration !<br />
<br/>
</p>
<h3>Mais la solution est la encore toute simple !</h3>
<p><strong><em>Il suffit d&#8217;ajouter le jquery.js dans un des répertoires source de votre projet et de l&#8217;inclure dans votre page courante.</em></strong><br />
La NetBeans parse le fichier, et gère automatiquement la complétion de code, magique non ? Encore fallait il le savoir et faire le test avant de perdre quelques 10aines de précieuses minutes a chercher comment faire.<br/></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=136</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>JQuery et MooTools sans conflit</title>
		<link>http://blog.konkest.com/?p=126</link>
		<comments>http://blog.konkest.com/?p=126#comments</comments>
		<pubDate>Fri, 17 Jul 2009 15:35:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MooTools]]></category>

		<guid isPermaLink="false">http://blog.konkest.com/?p=126</guid>
		<description><![CDATA[Plutôt adepte de JQuery, je me retrouve parfois confronté à l&#8217;utilisation de JQuery et de MooTools simultanément.
Ceci posera a coup sur des problèmes si l&#8217;on n&#8217;y prend pas garde du fait des grandes similitudes de notations comme l&#8217;appel à la fonction $.
Il existe bien évidement un contournement de ce genre de problèmes que voici :

Tout [...]]]></description>
			<content:encoded><![CDATA[<p>Plutôt adepte de JQuery, je me retrouve parfois confronté à l&#8217;utilisation de JQuery et de MooTools simultanément.<br />
Ceci posera a coup sur des problèmes si l&#8217;on n&#8217;y prend pas garde du fait des grandes similitudes de notations comme l&#8217;appel à la fonction $.</p>
<p>Il existe bien évidement un contournement de ce genre de problèmes que voici :</p>
<p><span id="more-126"></span></p>
<p>Tout d&#8217;abord il faut respecter l&#8217;ordre de déclaration des scripts :</p>
<ol>
<li>jquery.js</li>
<li>Vos autres scripts JQuery</li>
<li>mootools.js</li>
<li>Vos autres scripts MooTools</li>
</ol>
<p>Ensuite il faut dans la partie JQuery commencer par déclarer :</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Puis penser à remplacer dans tous les scripts JQuery les appels $() par jQuery()</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #006600; font-style: italic;">// On remplace par exemple </span>
    <span style="color: #006600; font-style: italic;">//     $(document.body).css('background-color', 'lightblue'); </span>
    <span style="color: #006600; font-style: italic;">// par :</span>
    jQuery<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'background-color'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'lightblue'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Voila si vous n&#8217;êtes pas certains d&#8217;avoir tout compris je vous propose un exemple super simple illustrant ce qu&#8217;il faut faire :</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;html&gt;
    &lt;head&gt;
        &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
        &lt;title&gt;Test JQuery et MooTools&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;h1&gt; Ceci est un test &lt;/h1&gt;
        &lt;!-- // DEBUT SCRIPTS JS --&gt;
        &lt;script language=&quot;Javascript&quot; type=&quot;text/javascript&quot; src=&quot;js/jquery.js&quot;&gt;&lt;/script&gt;
        &lt;script language=&quot;Javascript&quot; type=&quot;text/javascript&quot;&gt;
            // JQuery
            jQuery.noConflict();
            jQuery(document.body).css('background-color', 'lightblue');
        &lt;/script&gt;
        &lt;!-- Déclarer MooTools et les scripts MooTools après JQuery et les scripts JQuery --&gt;
        &lt;script language=&quot;Javascript&quot; type=&quot;text/javascript&quot; src=&quot;js/mootools.js&quot;&gt;&lt;/script&gt;
        &lt;script language=&quot;Javascript&quot; type=&quot;text/javascript&quot;&gt;
            // MooTools
            var bodyElement = $(document.body);
            bodyElement.setStyle('color', 'darkgreen');
        &lt;/script&gt;
        &lt;!-- // FIN SCRIPTS JS --&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=126</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>IDE PHP lequel chosir ?</title>
		<link>http://blog.konkest.com/?p=123</link>
		<comments>http://blog.konkest.com/?p=123#comments</comments>
		<pubDate>Wed, 08 Jul 2009 08:33:58 +0000</pubDate>
		<dc:creator>finalspy</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Aptana]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[PDT]]></category>

		<guid isPermaLink="false">http://blog.konkest.com/?p=123</guid>
		<description><![CDATA[Si comme moi vous vous êtes un jour dit que textpad, notepad ou autre éditeur de texte simple, bien que suffisant pour faire du php+html+css+js, n&#8217;est pas toujours hyper productif. J&#8217;entends pas la que ces outils manquent de fonctionnalités avancées, ou sont configurables mais difficilement et pas nativement, ou peu complets concernants les points suivants [...]]]></description>
			<content:encoded><![CDATA[<p>Si comme moi vous vous êtes un jour dit que textpad, notepad ou autre éditeur de texte simple, bien que suffisant pour faire du php+html+css+js, n&#8217;est pas toujours hyper productif. J&#8217;entends pas la que ces outils manquent de fonctionnalités avancées, ou sont configurables mais difficilement et pas nativement, ou peu complets concernants les points suivants :</p>
<ul>
<li>pas ou peu de complétion,</li>
<li>mise en forme limitée,</li>
<li>pas mis en évidence des erreurs de syntaxe&#8230;</li>
</ul>
<p>Alors l&#8217;article suivant va vous éclairer sur la question : <a href="http://www.smashingmagazine.com/2009/02/11/the-big-php-ides-test-why-use-oneand-which-to-choose/">The big PHP IDE&#8217;s test &#8211; Why use one and which to choose ?</a></p>
<p><span id="more-123"></span></p>
<p>Traduction française en cours.<br />
<!-- Voici une traduction de mon cru de ce magnifique article par ... --></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=123</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Un peu plus loin avec Wicket et Spring : Vive l&#8217;AOP !</title>
		<link>http://blog.konkest.com/?p=73</link>
		<comments>http://blog.konkest.com/?p=73#comments</comments>
		<pubDate>Thu, 02 Jul 2009 21:32:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[AOP]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Wicket]]></category>

		<guid isPermaLink="false">http://blog.konkest.com/?p=73</guid>
		<description><![CDATA[Ceux qui connaissent un peu Spring et l&#8217;AOP sauront l&#8217;intérêt énorme de cette technique de programmation pourtant encore trop peu connue des développeurs (en tout cas de ceux que je croise).
Je vous propose ici de saupoudrer votre merveilleuse plateforme Eclipse Maven Wicket Spring avec une dose d&#8217;AOP histoire de devenir encore un peu plus performants [...]]]></description>
			<content:encoded><![CDATA[<p>Ceux qui connaissent un peu Spring et l&#8217;AOP sauront l&#8217;intérêt énorme de cette technique de programmation pourtant encore trop peu connue des développeurs (en tout cas de ceux que je croise).</p>
<p>Je vous propose ici de saupoudrer votre merveilleuse plateforme Eclipse Maven Wicket Spring avec une dose d&#8217;AOP histoire de devenir encore un peu plus performants !</p>
<p><span id="more-73"></span></p>
<p>L&#8217;article qui suit décrit comment ajouter un peu d&#8217;AOP sur un projet Wicket.<br />
Pour prendre un exemple concret nous allons ajouter en AOP des traces vers la console rapportant l&#8217;utilisation de méthodes d&#8217;objets injectés et également leur temps d&#8217;exécution, sympa non ?</p>
<h2>Pour bien commencer</h2>
<h3>Pré-requis</h3>
<p>Avoir Eclipse (si possible <a href="http://www.eclipse.org/ganymede/">Ganymède pour développeurs JavaEE</a>).<br />
Avoir le <a href="http://m2eclipse.codehaus.org/">plugin Maven m2eclipse</a> installé.<br />
Avoir le <a href="http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA">plugin Subversion Subclipse</a> installé.</p>
<p>Savoir <a href="http://www.noocodecommit.com/blog/nicogiard/java/commencer-avec-wicket-quickstart-33">créer un projet Maven avec l&#8217;archetype Wicket</a> (version 1.3.6 pour cet exemple).</p>
<p>Et avoir lu l&#8217;<a href="http://blog.konkest.com/?p=11">article sur le couplage Wicket Spring</a> (ou sur <a href="http://www.noocodecommit.com/blog/nicogiard/java/coupler-wicket-et-spring">noocodecommit</a>) serait un plus.<br />
Savoir importer un projet SVN sous eclipse également.</p>
<h3>Sources de départ</h3>
<p>Les sources pour bien commencer sont disponibles sous SVN : <a href="http://blog.konkest.com/svn/WicketSpring">http://blog.konkest.com/svn/WicketSpring</a> (non ce n&#8217;est pas une erreur et bien les sources d&#8217;un précédent article sur lequel nous nous baserons pour la présente démonstration).</p>
<h3>Rappel Couplage wicket Spring</h3>
<p>1°) Modifier le pom.xml et rajouter d&#8217;une part les dépendances Spring :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.wicket<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>wicket-spring-annot<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${wicket.version}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #808080; font-style: italic;">&lt;!--  SPRING DEPENDENCIES --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>spring<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${spring.version}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>2°) et d&#8217;autre part la version des dépendances à utiliser :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wicket.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.3.6<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wicket.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jetty.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>6.1.4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jetty.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.5.4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>3°) Modification du niveau de compilateur en 1.5+ et des project facets en conséquence 5.0+<br />
Pour cela il faut faire un click droit sur le projet puis &laquo;&nbsp;propriétés&nbsp;&raquo;.<br />
Puis aller sur &laquo;&nbsp;Java Compiler&nbsp;&raquo; et changer le &laquo;&nbsp;Compiler compliance level&nbsp;&raquo; (désolé je bosse sous une version anglaise).<br />
<img src="http://blog.konkest.com/wp-content/uploads/2009/07/ChangeCompilerlevel-150x150.png" alt="Change compiler level" title="Change compiler level" width="150" height="150" class="alignnone size-thumbnail wp-image-111" /></p>
<p>Ensuite allez sur &laquo;&nbsp;Project Facets&nbsp;&raquo; et changez Java de 1.4 à 5.0 au moins, en cliquant sur &laquo;&nbsp;Modify project&nbsp;&raquo;.<br />
Voici comment se présentent ces écrans :<br />
<img src="http://blog.konkest.com/wp-content/uploads/2009/07/ModifyProjectFacet-150x150.png" alt="Modify Project Facet" title="Modify Project Facet" width="150" height="150" class="alignnone size-thumbnail wp-image-112" /><br />
<img src="http://blog.konkest.com/wp-content/uploads/2009/07/ChooseFacet5-150x150.png" alt="Choose Facets" title="Choose Facets" width="150" height="150" class="alignnone size-thumbnail wp-image-113" /></p>
<p>4°) Ajout de la référence au fichier de configuration Spring dans web.xml</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Déclaration du fichier externe de configuration de Spring --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>contextConfigLocation<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>classpath:springConfiguration.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>5°) Ajout du fichier springConfiguration.xml</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">	   <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">	   <span style="color: #000066;">xmlns:context</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/context&quot;</span></span>
<span style="color: #009900;">	   <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans</span>
<span style="color: #009900;">	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</span>
<span style="color: #009900;">	http://www.springframework.org/schema/context</span>
<span style="color: #009900;">	http://www.springframework.org/schema/context/spring-context-2.5.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
 	<span style="color: #808080; font-style: italic;">&lt;!-- Indique à  Spring de scanner les package pour trouver les annotations en vue de l'injection --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:annotation-config</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:component-scan</span> <span style="color: #000066;">base-package</span>=<span style="color: #ff0000;">&quot;com.konkest&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
	<span style="color: #808080; font-style: italic;">&lt;!-- Indique à Spring quelle classe Wicket doit être injectée en tant qu'application --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;wicketApplication&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.konkest.WicketSpring.WicketApplication&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Attention cela ne suffit pas pour cet exemple puisqu&#8217;il vous faut ajouter des classes à injecter via Spring&#8230;<br />
(cf. <a href="http://blog.konkest.com/svn/WicketSpring">les sources SVN</a> et l&#8217;<a href="http://blog.konkest.com/?p=11">article sur le couplage Wicket et Spring</a>.)</p>
<h2>Configuration &#8230; </h2>
<p>Ici j&#8217;utilise l&#8217;AOP dans le cadre de Spring.<br />
Pas forcément la meilleure utilisation de l&#8217;AOP, mais facile et rapide a mettre en oeuvre pour de petits besoins.</p>
<h3>Ajout des dépendances Maven pour l&#8217;AOP</h3>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>spring-aop<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${spring.version}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>spring-aspects<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${spring.version}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h3>Déclaration de l&#8217;AOP</h3>
<p>Dans le springConfiguration.xml<br />
Ajout des namespaces aop</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot;</pre></div></div>

<p>et dans la partie schemaLocation :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd</pre></div></div>

<h3>Ajout des déclarations de &laquo;&nbsp;jointpoint&nbsp;&raquo; et d&#8217;&nbsp;&raquo;aspect&nbsp;&raquo;</h3>
<p>Dans le springConfiguration.xml toujours :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--	Debut de la configuration AOP --&gt;</span>	
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;aop:config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;aop:pointcut</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;pagePointcut&quot;</span>  <span style="color: #000066;">expression</span>=<span style="color: #ff0000;">&quot;execution(* com.konkest.faune.*.*(..))&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>     		
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;aop:aspect</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;testAspect&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;myTimer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;aop:before</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;pageMethodEntry&quot;</span>  <span style="color: #000066;">pointcut-ref</span>=<span style="color: #ff0000;">&quot;pagePointcut&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>    		
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;aop:after</span> <span style="color: #000066;">method</span>=<span style="color: #ff0000;">&quot;pageMethodExit&quot;</span> <span style="color: #000066;">pointcut-ref</span>=<span style="color: #ff0000;">&quot;pagePointcut&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/aop:aspect<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	    
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/aop:config<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><em>Attention notez bien que je définis le pointcut sur les méthodes des classes du package faune uniquement.<br />
Cela est fait volontairement car Spring ne peut bien évidement travailler en AOP que sur des choses qu&#8217;il connait, donc des classes qui lui ont été déclarées comme par exemple Chien et/ou Chat via l&#8217;injection de dépendances.<br />
Par ailleurs si vous tentez de mettre : </p>
<pre>expression="execution(* com.konkest..*(..))"</pre>
<p>(qui défini le pointcut sur l&#8217;exécution de toutes les méthodes de toutes les classes du package com.konkest et de ses sous-packages)<br />
Vous constaterez que rien de plus n&#8217;apparait dans notre exemple. Forcément Spring ne connait rien d&#8217;autre dans le cas présent.</em></p>
<h3>Déclaration du Bean de l&#8217;aspect</h3>
<p>Dans le springConfiguration.xml encore :<br />
Ajout de la déclaration du bean référencé par pageCallCounter qui contient l&#8217;aspect et ses méthodes</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;myTimer&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.konkest.aspect.MethodeTimer&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<h2>Notre aspect de test</h2>
<p>Pour cet exemple simpliste nous allons juste tracer le temps d&#8217;exécution d&#8217;une méthode.<br />
Cela montre quand meme l&#8217;utilité de l&#8217;AOP pour ajouter des traces applicatives après coup, ou pour tenter par exemple de débusquer les point faibles d&#8217;une application en termes de performance.<br />
Voici le code de notre aspect de test &laquo;&nbsp;MethodeTimer&nbsp;&raquo;, à placer dans le package &laquo;&nbsp;com.konkest.aspect&nbsp;&raquo;</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.konkest.aspect</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.aspectj.lang.JoinPoint</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.aspectj.lang.JoinPoint.StaticPart</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MethodTimer <span style="color: #009900;">&#123;</span>
	  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">long</span> start<span style="color: #339933;">;</span>
	  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">long</span> duration<span style="color: #339933;">;</span>
&nbsp;
	  <span style="color: #666666; font-style: italic;">// Cette méthode est appelée à chaque fois (et avant) qu'une méthode du package défini dans le pointcut est interceptée </span>
	  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> pageMethodEntry<span style="color: #009900;">&#40;</span>JoinPoint joinPoint<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		 <span style="color: #666666; font-style: italic;">// Nom de la méthode interceptée</span>
		 <span style="color: #003399;">String</span> name <span style="color: #339933;">=</span> joinPoint.<span style="color: #006633;">getSignature</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toLongString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		 <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;### Start : &quot;</span> <span style="color: #339933;">+</span> name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		 start <span style="color: #339933;">=</span> <span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	  <span style="color: #009900;">&#125;</span>
&nbsp;
	  <span style="color: #666666; font-style: italic;">// Cette méthode est appelée à chaque fois (et après) qu'une méthode du package défini dans le pointcut est interceptée </span>
	  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> pageMethodExit<span style="color: #009900;">&#40;</span>StaticPart staticPart<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		 duration <span style="color: #339933;">=</span> <span style="color: #003399;">System</span>.<span style="color: #006633;">currentTimeMillis</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> start<span style="color: #339933;">;</span>
		 <span style="color: #666666; font-style: italic;">// Nom de la méthode interceptée</span>
		 <span style="color: #003399;">String</span> name <span style="color: #339933;">=</span> staticPart.<span style="color: #006633;">getSignature</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toLongString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		 <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;### End of &quot;</span> <span style="color: #339933;">+</span> name <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; after &quot;</span> <span style="color: #339933;">+</span> duration <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; ms.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>Test de notre aspect (non ce n&#8217;est pas du verlan ^^)</h2>
<p>Et bien il faut exécuter notre projet sur le serveur Tomcat&#8230; (clique droit sur le Projet, Run As > Run on server)</p>
<p>Et voici si tout va bien le résultat :</p>
<h3>Console :</h3>
<p>	<img src="http://blog.konkest.com/wp-content/uploads/2009/07/Test-150x150.png" alt="Vue console montrant des traces générées par AOP." title="Vue console montrant des traces générées par AOP." width="150" height="150" class="aligncenter size-thumbnail wp-image-110" /></p>
<h3>Sources du présent article</h3>
<p>Les sources de cet article sont disponibles sous SVN : <a href="http://blog.konkest.com/svn/WicketAOPSpring">http://blog.konkest.com/svn/WicketAOPSpring</a>.</p>
<h2>Conclusions</h2>
<p>Nous venons de voir que nous pouvons aisément utiliser Spring pour faire outre l&#8217;injection de dépendance, de la programmation orientée aspect, le tout sur notre application Wicket. Elle est pas belle la vie ?</p>
<p>Seules remarques négatives, à ma connaissance et du fait du mécanisme interne de Spring AOP par création automatique de proxy au chargement, l&#8217;utilisation de l&#8217;AOP est limitée uniquement sur l&#8217;exécution des méthodes des classes injectées. Et également de possibles problèmes de performance (je n&#8217;ai jamais utilisé l&#8217;AOP suffisamment en profondeur avec Spring ou un autre tisseur d&#8217;aspect pour en juger par moi-même).</p>
<p>C&#8217;est déjà pas mal mais on peut mieux faire &#8230; Affaire à suivre donc, par exemple avec AspectJ et le plugin AspectJDevelopmentTool (AJDT) sous Eclipse.</p>
<hr />
<h2>Ressources</h2>
<p>Pour compléter cet article je vous propose de poursuivre la lecture sur les pages suivantes :</p>
<ul>
<li><a href="http://ewawszczyk.developpez.com/tutoriel/java/spring/aop/">Tutoriel AOP sur Developpez.com </a></li>
<li><a href="http://static.springframework.org/spring/docs/2.5.x/reference/aop.html">Documentation Spring AOP</a></li>
<li><a href="http://www.geekeries.com/2008/09/15/initiation-a-la-programmation-orientee-aspect/">Initiation AOP sur Geekeries.com</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=73</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>window.location &#8211; Changement de page JavaScript</title>
		<link>http://blog.konkest.com/?p=91</link>
		<comments>http://blog.konkest.com/?p=91#comments</comments>
		<pubDate>Fri, 05 Jun 2009 23:07:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[href]]></category>
		<category><![CDATA[onclick]]></category>
		<category><![CDATA[redirection]]></category>
		<category><![CDATA[setTimeout]]></category>
		<category><![CDATA[window.location]]></category>

		<guid isPermaLink="false">http://blog.konkest.com/?p=91</guid>
		<description><![CDATA[Encore un siouxerie JavaScript qui m&#8217;a fait m&#8217;arracher les cheveux qui me restent avant de trouver la solution.
Habitué par le passé, à coder en html/javascript, je me souvenais que l&#8217;on pouvait simuler un lien par du JavaScript en utilisant le code suivant par exemple :

    &#60;span onclick=&#34;window.location='nouvellePage.htm'&#34;&#62; cliquez ici &#60;/span&#62;

Sauf que voilà [...]]]></description>
			<content:encoded><![CDATA[<p>Encore un siouxerie JavaScript qui m&#8217;a fait m&#8217;arracher les cheveux qui me restent avant de trouver la solution.<br />
Habitué par le passé, à coder en html/javascript, je me souvenais que l&#8217;on pouvait simuler un lien par du JavaScript en utilisant le code suivant par exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">    &lt;span onclick=&quot;window.location='nouvellePage.htm'&quot;&gt; cliquez ici &lt;/span&gt;</pre></div></div>

<p>Sauf que voilà sur mes derniers tests cela ne fonctionne pas !</p>
<p><span id="more-91"></span></p>
<p>J&#8217;ai donc cherché et testé un paquet de méthodes pour arriver à mes fins.<br />
Et j&#8217;ai fini par trouver la solution que je vous livre ci-dessous.</p>
<h2>Solution</h2>
<p>Il faut donc utiliser <strong>window.location.href</strong>, combiné à la méthode <strong>setTimeout()</strong> normalement utilisée pour retarder l&#8217;exécution d&#8217;une action javascript.</p>
<p>Ne me demandez pas le pourquoi ce ce mystère, mais cette méthode a le mérite de fonctionner sur les divers navigateurs testé dont :</p>
<ul>
<li>Firefox 3.0</li>
<li>Internet Explorer 7</li>
<li>Chrome 2</li>
<li>Safari</li>
<li>Opera</li>
</ul>
<p>L&#8217;explication que j&#8217;ai pu lire est que certains navigateurs n&#8217;effectueront pas le changement de page tant que la page en cours n&#8217;aura pas terminé son chargement.<br />
Par ailleurs il semblerait (à vérifier) que window.location soit une ancienne forme qui ne devrais plus être utilisé, mais certains sites mentionne window.location.href comme une abbération microsoft ? Qui croire ? &#8230; toujours est il que parfois ca marche sans le href et parfois non&#8230; (et cela sur les meme navigateurs mais des machines différentes).</p>
<p><em>Si quelqu&#8217;un qui passe par la a une idée ou une explication, je prends.<br />
</em></p>
<p>Sinon, une chose intéressante est aussi d&#8217;externaliser le code ci-dessus pour le réutiliser à plusieurs endroits.<br />
Mais attention il peut-être perturbant d&#8217;utiliser setTimeout et window.location.href dans une fonction javascript paramétrable du fait de la position des doubles et simple guillemets!</p>
<p>Voici donc un exemple correct :</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>  
        <span style="color: #003366; font-weight: bold;">function</span> changePageSimple<span style="color: #009900;">&#40;</span>newpage<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
            <span style="color: #006600; font-style: italic;">// Attention a noter la position des &quot; et ' très importante sinon cela ne marche pas. </span>
            setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;window.location.href = '&quot;</span><span style="color: #339933;">+</span>newpage<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;.php'&quot;</span> <span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
        <span style="color: #009900;">&#125;</span> 
    <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>suivi de &#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">    &lt;li onclick=&quot;changePageSimple('nouvellePage');&quot;&gt;cliquez ici&lt;/li&gt;</pre></div></div>

<p>Encore une fois j&#8217;espère avoir été utile à quelqu&#8217;un et que le temps que j&#8217;ai pu moi même passer à trouver la solution à ce problème ait été épargné à une autre personne.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=91</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utiliser Spring pour l&#039;injection de dépendances sous Wicket !</title>
		<link>http://blog.konkest.com/?p=11</link>
		<comments>http://blog.konkest.com/?p=11#comments</comments>
		<pubDate>Sat, 23 May 2009 00:50:48 +0000</pubDate>
		<dc:creator>finalspy</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[annotations]]></category>
		<category><![CDATA[DI]]></category>
		<category><![CDATA[IOC]]></category>
		<category><![CDATA[Spring]]></category>

		<guid isPermaLink="false">http://konkest.wordpress.com/?p=11</guid>
		<description><![CDATA[Cet article va vous présenter les quelques étapes nécessaires pour coupler Wicket avec Spring, histoire de bénéficier par exemple de l&#8217;injection de dépendances.

Pré-requis
 Cet article suppose que vous avez lu et appliqué la série d&#8217;articles suivante :
Installation (part 1/3)
Configuration (part 2/3)
QuickStart (part 3/3)

Si vous avez tout suivi à la lettre, et que vous lancez l&#8217;application [...]]]></description>
			<content:encoded><![CDATA[<p>Cet article va vous présenter les quelques étapes nécessaires pour coupler Wicket avec Spring, histoire de bénéficier par exemple de l&#8217;injection de dépendances.</p>
<p><span id="more-11"></span></p>
<h2>Pré-requis</h2>
<ul> Cet article suppose que vous avez lu et appliqué la série d&#8217;articles suivante :</p>
<li><a title="Installation (part 1/3)" href="http://www.noocodecommit.com/blog/nicogiard/java/commencer-avec-wicket-installation-13" target="_self">Installation (part 1/3)</a></li>
<li><a title="Configuration (part 2/3)" href="http://www.noocodecommit.com/blog/nicogiard/java/commencer-avec-wicket-configuration-23">Configuration (part 2/3)</a></li>
<li><a title="QuickStart (part 3/3)" href="http://www.noocodecommit.com/blog/nicogiard/java/commencer-avec-wicket-quickstart-33">QuickStart (part 3/3)</a><a href="http://konkest.files.wordpress.com/2009/05/20090523_01_wicketsamplerunning.png"><img class="alignright size-thumbnail wp-image-61" title="20090523_01_WicketSampleRunning" src="http://konkest.files.wordpress.com/2009/05/20090523_01_wicketsamplerunning.png?w=150" alt="20090523_01_WicketSampleRunning" width="150" height="112" /></a></li>
</ul>
<p>Si vous avez tout suivi à la lettre, et que vous lancez l&#8217;application sur un serveur (Click droit sur le projet, Run As &gt; Run on Server), vous devriez voir la page suivante dans un navigateur :</p>
<h2>L&#8217;ajout de Spring</h2>
<h3>Ajout des dépendances dans Maven</h3>
<p>Dans un premier temps nous allons ajouter une dépendance pour permettre l&#8217;intégration de Wicket et Spring.</p>
<p>Pour cela, dans le fichier pom.xml ajouter la dépendance suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.apache.wicket<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>wicket-spring-annot<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${wicket.version}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Si vous avez suivi le QuickStart sur Wicket et Maven vous devriez avoir la variable wicket.version définie en bas de fichier. Sinon pensez à la déclarer &#8230;</p>
<p>Ensuite il faut ajouter la déclaration de dépendance du package principal de Spring (pas l&#8217;unique mais ici ce sera suffisant).</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--  SPRING DEPENDENCIES --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/groupId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>spring<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/artifactId<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${spring.version}<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>La encore vous remarquerez l&#8217;utilisation d&#8217;une variable &laquo;&nbsp;spring.version&nbsp;&raquo; qu&#8217;il faut déclarer en fin de fichier en ajoutant par exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;wicket.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1.3.5<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/wicket.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jetty.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>6.1.4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/jetty.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;spring.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2.5.4<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/spring.version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h3>Préparer l&#8217;application pour l&#8217;utilisation de Spring</h3>
<p>Il faut modifier ensuite votre application Wicket pour y  ajouter d&#8217;une part une méthode de récupération du contexte comme suit :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Récupération du contexte applicatif
 * @return ApplicationContext
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> ApplicationContext context<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> WebApplicationContextUtils.<span style="color: #006633;">getRequiredWebApplicationContext</span><span style="color: #009900;">&#40;</span>getServletContext<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Puis ensuite toujours dans votre application modifier la méthode init() pour ajouter un écouteur d&#8217;instanciation de composant utilisant l&#8217;injection de dépendance de Spring.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// Permettre l'injection de dépendances par Spring</span>
    addComponentInstantiationListener<span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> SpringComponentInjector<span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">this</span>, context<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Pour vous éviter les galères si votre IDE negère pas la recherche automatique d&#8217;imports, voici donc les imports nécessaires :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.spring.injection.annot.SpringComponentInjector</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.context.ApplicationContext</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.web.context.support.WebApplicationContextUtils</span><span style="color: #339933;">;</span></pre></div></div>

<p><em>A ce stade si votre projet est en build automatique et que votre serveur détecte les changements et se relance, il y aura des erreurs car nous n&#8217;avons pas configuré Spring et son contexte applicatif.</em></p>
<h3>Ajout d&#8217;un fichier de configuration pour Spring</h3>
<p>Il faut modifier le fichier Web.xml et ajouter la déclaration du fichier de paramétrage spécifique de Spring, en début de fichier, après le display-name idéalement, de la façon suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Déclaration du fichier externe de configuration de Spring --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>contextConfigLocation<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>classpath:springConfiguration.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Il faut également rajouter la déclaration de listener suivant en fin de fichier web.xml, pour permettre l&#8217;utilisation de beans de portée request, session, global session. Attention le code qui suit est valable pour les conteneurs de servlets 2.4 et supèrieurs. (pour plus de détails sur la configuration Spring se reporter à la Documentation Spring &#8211; lien dans les ressources en bas de cet article).</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- Declaration du Listener de chargement de contexte de Spring --&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.web.context.ContextLoaderListener<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Puis bien évidement il faut créer le fichier en question et le placer idéalement dans le répertoire src/main/resources.</p>
<p>Voici le contenu minimum du fichier :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">		  <span style="color: #000066;">xmlns:context</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/context&quot;</span></span>
<span style="color: #009900;">		  <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans</span>
<span style="color: #009900;">		                               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</span>
<span style="color: #009900;">				               http://www.springframework.org/schema/context</span>
<span style="color: #009900;">				               http://www.springframework.org/schema/context/spring-context-2.5.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #808080; font-style: italic;">&lt;!-- Indique à Spring quelle classe Wicket doit être injectée en tant qu'application --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;wicketApplication&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.konkest.WicketSpring.WicketApplication&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Pensez à remplacer &laquo;&nbsp;com.konkest.WicketSpring.WicketApplication&nbsp;&raquo; par le path complet de votre application package+classe.</p>
<p><em>A ce stade votre projet doit compiler et se lancer sur le serveur sans changement notable.</em></p>
<p>(Tout cela c&#8217;est bien beau mais si on en fait rien ça n&#8217;a pas d&#8217;intérêt.)</p>
<h2>Testons un peu le couplage Spring/Wicket</h2>
<p>Nous allons tester l&#8217;une des fonctionnalités la plus utilisée de Spring :  <strong>l&#8217;injection de dépendances</strong>.</p>
<p>Pour cela je vous propose de créer un exemple idiot constitué de :</p>
<ul>
<li>une interface IAnimal proposant une méthode :
<ul>
<li>public String crier();

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> IAnimal <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> crier<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

</li>
</ul>
</li>
<li>Et deux classes l&#8217;implémentant :
<ul>
<li>Chien qui retourne &laquo;&nbsp;Ouaf ouaf&nbsp;&raquo;</li>
<li>Chat qui retourne &laquo;&nbsp;Miaou miaou&nbsp;&raquo;</li>
</ul>
</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.stereotype.Component</span><span style="color: #339933;">;</span>
@<span style="color: #003399;">Component</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;chien&quot;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Chien <span style="color: #000000; font-weight: bold;">implements</span> IAnimal <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> crier<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;ouaf ouaf&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>et</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.stereotype.Component</span><span style="color: #339933;">;</span>
@<span style="color: #003399;">Component</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;chat&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Chat <span style="color: #000000; font-weight: bold;">implements</span> IAnimal<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> crier<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;miaou miaou&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Et bien évidement nous allons utiliser tout cela dans notre HomePage Wicket en ne manipulant que l&#8217;interface, et injecter l&#8217;implémentation via Spring.</p>
<h3>Injection par annotations</h3>
<p>Première chose à faire pour permettre l&#8217;utilisation des annotations, il faut configurer votre projet Eclipse pour les supporter. Pour cela deux choses à faire :</p>
<ul>
<li>Ajouter une compatibilité java 5.0 (Click droit sur le projet, puis Properties et Java Compiler, changer alors le compiler compliance level sur 5.0)</li>
</ul>
<p style="text-align:center;"><a href="http://konkest.files.wordpress.com/2009/05/20090523_03_changecompilerlevel.png"><img class="size-thumbnail wp-image-64 aligncenter" title="20090523_03_ChangeCompilerLevel" src="http://konkest.files.wordpress.com/2009/05/20090523_03_changecompilerlevel.png?w=139" alt="20090523_03_ChangeCompilerLevel" width="139" height="150" /></a></p>
<ul>
<li>Changer le niveau de project facets (toujours dans les propriétés du projet, choisir Project Facets et vérifier que la version pour Java est à 5.0)</li>
</ul>
<p style="text-align:center;"><img class="size-thumbnail wp-image-65 aligncenter" title="20090523_02_ChangeProjectFacet" src="http://konkest.files.wordpress.com/2009/05/20090523_02_changeprojectfacet.png?w=150" alt="20090523_02_ChangeProjectFacet" width="150" height="130" /></p>
<p>Maintenant nous allons rajouter la déclaration de l&#8217;interface IAnimal dans la HomePage :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@SpringBean<span style="color: #009900;">&#40;</span> name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;chien&quot;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">private</span> IAnimal animal<span style="color: #339933;">;</span></pre></div></div>

<p>Il faut alors importer :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.apache.wicket.spring.injection.annot.SpringBean</span><span style="color: #339933;">;</span></pre></div></div>

<p>ainsi que IAnimal si elle n&#8217;est pas dans le package de la HomePage.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.konkest.faune.IAnimal</span><span style="color: #339933;">;</span></pre></div></div>

<p>Puis pour le besoin du test on va appeler la méthode crier de l&#8217;interface IAnimal :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Label</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;message&quot;</span>, <span style="color: #0000ff;">&quot;Mon animal fait : &quot;</span> <span style="color: #339933;">+</span> animal.<span style="color: #006633;">crier</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>en remplaçant le précédent Label généré automatiquement lors de la création du projet.</p>
<p><em>A ce stade le code compile et le serveur se lance mais l&#8217;application provoque une Unexpected Runtime Exception lorsque l&#8217;on y accède. En effet nous n&#8217;avons pas dit à Spring qu&#8217;il devait scanner les packages pour trouver les annotations et s&#8217;en servir pour l&#8217;injection des dépendances.</em></p>
<p><strong>Dernière étape donc :</strong> indiquer à Spring qu&#8217;il doit scanner les packages et utiliser les annotations pour l&#8217;injection. Pour cela il faut modifier le fichier de configuration de Spring dans notre projet : springConfiguration.xml, et ne pas oublier de modifier les déclarations de namespaces.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">   <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">   <span style="color: #000066;">xmlns:context</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/context&quot;</span></span>
<span style="color: #009900;">   <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans</span>
<span style="color: #009900;">                               http://www.springframework.org/schema/beans/spring-beans-2.5.xsd</span>
<span style="color: #009900;">		               http://www.springframework.org/schema/context</span>
<span style="color: #009900;">		               http://www.springframework.org/schema/context/spring-context-2.5.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:annotation-config</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context:component-scan</span> <span style="color: #000066;">base-package</span>=<span style="color: #ff0000;">&quot;com.konkest.WicketSpring&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p style="text-align:center;">Et voilà il n&#8217;y a plus qu&#8217;a tester en lançant votre serveur&#8230; si tout va bien &laquo;&nbsp;ouaf ouaf&nbsp;&raquo; devrait apparaitre&#8230;</p>
<p style="text-align:center;"><a href="http://konkest.files.wordpress.com/2009/05/20090523_04_ouaf.png"><img class="size-thumbnail wp-image-66 aligncenter" title="20090523_04_ouaf" src="http://konkest.files.wordpress.com/2009/05/20090523_04_ouaf.png?w=150" alt="20090523_04_ouaf" width="150" height="112" /></a></p>
<p>Changez donc l&#8217;annotation en :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@SpringBean<span style="color: #009900;">&#40;</span> name <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;chat&quot;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">private</span> IAnimal animal<span style="color: #339933;">;</span></pre></div></div>

<p>et relancez &#8230; &laquo;&nbsp;miaou miaou&nbsp;&raquo; &#8230;</p>
<p style="text-align:center;"><a href="http://konkest.files.wordpress.com/2009/05/20090523_05_miaou.png"><img class="size-thumbnail wp-image-67 aligncenter" title="20090523_05_miaou" src="http://konkest.files.wordpress.com/2009/05/20090523_05_miaou.png?w=150" alt="20090523_05_miaou" width="150" height="112" /></a></p>
<p style="text-align:center;">
<p>C&#8217;est un peu bof comme exemple mais ça prouve que l&#8217;injection via Spring fonctionne<br />
 <img src='http://blog.konkest.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Félicitations ! et merci pour la patience d&#8217;avoir suivi jusque là.</p>
<p>Prochaine étape Ajouter Hibernate &#8230; A suivre &#8230;</p>
<hr />
<h3><em> Sources disponibles sous SVN</em></h3>
<p><em> Se connecter au repository suivant : <a href="http://blog.konkest.com/svn/WicketSpring">http://blog.konkest.com/svn/WicketSpring</a> .</em></p>
<hr />
<h3><em> Ressources utilisées pour cet article:</em></h3>
<ul>
<li><em><a href="http://static.springframework.org/spring/docs/2.5.x/reference/beans.html#beans-factory-scopes-other-web-configuration">Documentation Spring</a></em></li>
<li><em><a href="http://cwiki.apache.org/WICKET/spring.html">Wiki Wicket</a></em></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=11</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Nexus Indexer vide sous Eclipse avec plugin m2eclipse &#8230;</title>
		<link>http://blog.konkest.com/?p=45</link>
		<comments>http://blog.konkest.com/?p=45#comments</comments>
		<pubDate>Fri, 22 May 2009 14:14:23 +0000</pubDate>
		<dc:creator>finalspy</dc:creator>
				<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[archetype]]></category>
		<category><![CDATA[m2eclipse]]></category>
		<category><![CDATA[repository]]></category>

		<guid isPermaLink="false">http://konkest.wordpress.com/?p=45</guid>
		<description><![CDATA[Au moment de choisir l&#8217;archétype pour démarrer mon nouveau projet, je me rends compte que dans la liste de Nexus Indexer il n&#8217;y a rien ! Vide&#8230; Néant &#8230;
Après pas mal d&#8217;installations d&#8217;Eclipse Ganymède et du plugin m2eclipse pour lui adjoindre des facilités d&#8217;utilisation de Maven, je me suis retrouvé confronté ce matin même à [...]]]></description>
			<content:encoded><![CDATA[<p>Au moment de choisir l&#8217;archétype pour démarrer mon nouveau projet, je me rends compte que dans la liste de Nexus Indexer il n&#8217;y a rien ! Vide&#8230; Néant &#8230;</p>
<p>Après pas mal d&#8217;installations d&#8217;<a href="http://www.eclipse.org/downloads/packages/">Eclipse Ganymède</a> et du <a href="http://m2eclipse.sonatype.org/">plugin m2eclipse</a> pour lui adjoindre des facilités d&#8217;utilisation de Maven, je me suis retrouvé confronté ce matin même à cette étrangeté.</p>
<p><span id="more-45"></span></p>
<p>Habituellement pour démarrer un projet Wicket par exemple, je le démarre à partir d&#8217;un projet Maven en choisissant l&#8217;archetype qui va bien.<br />
( Comme indiqué dans ce très bon <strong><a href="http://www.noocodecommit.com/blog/nicogiard/java/commencer-avec-wicket-quickstart-33">tutorial sur NooCodeCommit</a></strong>, que je ne vais pas perdre de temps à recopier.)</p>
<p>Bref voila que je démarre mon projet, et au moment de choisir l&#8217;archétype, je me rends compte que dans la liste de Nexus Indexer il n&#8217;y a rien ! Vide&#8230; Néant &#8230;<br />
<a href="http://konkest.files.wordpress.com/2009/05/20090522_00_emptynexusindexer.png"><img class="size-thumbnail wp-image-47" title="20090522_00_EmptyNexusIndexer" src="http://konkest.files.wordpress.com/2009/05/20090522_00_emptynexusindexer.png?w=138" alt="legende" width="138" height="150" /></a></p>
<p>Je n&#8217;ai pas encore l&#8217;explication du pourquoi du comment cela a toujours fonctionné sauf dans mon installation de ce matin.</p>
<p></p>
<h3>Cependant j&#8217;ai trouvé comment résoudre le problème.</h3>
<p>Pour cela, allez sur <strong>Window &gt; Show View &gt; Other</strong></p>
<p><a href="http://konkest.files.wordpress.com/2009/05/20090522_01_showview.png"><img class="size-thumbnail wp-image-46" title="20090522_01_ShowView" src="http://konkest.files.wordpress.com/2009/05/20090522_01_showview.png?w=150" alt="legende" width="150" height="112" /></a></p>
<p>Puis choisir <strong>Maven &gt; Maven Indexes</strong></p>
<p><a href="http://konkest.files.wordpress.com/2009/05/20090522_02_choosemavenindexer.png"><img class="size-thumbnail wp-image-48" title="20090522_02_ChooseMavenIndexer" src="http://konkest.files.wordpress.com/2009/05/20090522_02_choosemavenindexer.png?w=100" alt="legende" width="100" height="150" /></a></p>
<p>Là j&#8217;ai effectivement constaté que je n&#8217;avais que le repository relatif a mon workspace et mon repository local dans mon .m2 :</p>
<p><a href="http://konkest.files.wordpress.com/2009/05/20090522_03_missingmavenrepo.png"><img class="size-thumbnail wp-image-49" title="20090522_03_MissingMavenRepo" src="http://konkest.files.wordpress.com/2009/05/20090522_03_missingmavenrepo.png?w=150" alt="legende" width="150" height="40" /></a></p>
<p>J&#8217;ai alors rajouté le repository central de maven : <strong>http://repo1.maven.org/maven2</strong></p>
<p><a href="http://konkest.files.wordpress.com/2009/05/20090522_04_addcentralrepo.png"><img class="size-thumbnail wp-image-50" title="20090522_04_AddCentralRepo" src="http://konkest.files.wordpress.com/2009/05/20090522_04_addcentralrepo.png?w=150" alt="legende" width="150" height="59" /></a></p>
<p>Il faut alors vérifier qu&#8217;il a bien été ajouté dans la vue &laquo;&nbsp;Maven Indexes&nbsp;&raquo;</p>
<p><a href="http://konkest.files.wordpress.com/2009/05/20090522_05_centralrepoadded.png"><img class="size-thumbnail wp-image-51" title="20090522_05_CentralRepoAdded" src="http://konkest.files.wordpress.com/2009/05/20090522_05_centralrepoadded.png?w=150" alt="legende" width="150" height="41" /></a></p>
<p>Enfin il ne reste ainsi plus qu&#8217;a retourner sous <strong>File &gt; New &gt; Project</strong> puis <strong>Maven &gt; Maven Project</strong> et vérifier que sur l&#8217;écran de sélection des archetypes la liste est revenue pour le Nexus Indexer :</p>
<p><a href="http://konkest.files.wordpress.com/2009/05/20090522_06_nexusindexerok.png"><img class="size-thumbnail wp-image-52" title="20090522_06_NexusIndexerOK" src="http://konkest.files.wordpress.com/2009/05/20090522_06_nexusindexerok.png?w=150" alt="legende" width="150" height="128" /></a></p>
<p>J&#8217;espère que cela sera utile à quelqu&#8217;un, histoire que je sois le seul a y avoir perdu encore quelques cheveux ^^</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=45</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NormandyJUG Première !</title>
		<link>http://blog.konkest.com/?p=41</link>
		<comments>http://blog.konkest.com/?p=41#comments</comments>
		<pubDate>Tue, 19 May 2009 14:52:22 +0000</pubDate>
		<dc:creator>finalspy</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[NormandyJUG]]></category>
		<category><![CDATA[Wicket]]></category>
		<category><![CDATA[google web toolkit]]></category>
		<category><![CDATA[gwt]]></category>
		<category><![CDATA[intégration continue]]></category>
		<category><![CDATA[java user group]]></category>
		<category><![CDATA[JUG]]></category>

		<guid isPermaLink="false">http://konkest.wordpress.com/?p=41</guid>
		<description><![CDATA[ C&#8217;est officiel, la première réunion du NormandyJUG (Java User Group) se tiendra le Mardi 16 Juin à partir de 19h au pôle normand des échanges électronqiues.
Elle aura pour principal sujet la comparaison de deux des frameworks Web en technologie Java qui font le plus parler d&#8217;eux en ce moment :
Google Web Toolkit (GWT) face [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-42" style="margin: 100px 20px;" title="logo-juggy2" src="http://konkest.files.wordpress.com/2009/05/logo-juggy2.png" alt="logo-juggy2" width="133" height="160" /> C&#8217;est officiel, la première réunion du NormandyJUG (Java User Group) se tiendra le Mardi 16 Juin à partir de 19h au pôle normand des échanges électronqiues.</p>
<p style="text-align: left;">Elle aura pour principal sujet la comparaison de deux des frameworks Web en technologie Java qui font le plus parler d&#8217;eux en ce moment :<br />
<strong>Google Web Toolkit (GWT) face à Wicket !</strong></p>
<p>Les contributeurs :</p>
<p style="text-align: center;">Youen Chéné (<a href="http://www.fermiersdacote.com">www.fermiersdacote.com</a>)</p>
<p style="text-align: center;">Nicolas Giard (<a href="http://www.noocodecommit.com">www.noocodecommit.com</a>)</p>
<p>La deuxième partie sera consacrée à :<br />
<strong>l&#8217;Intégration Continue</strong></p>
<p>Contributeur :</p>
<p style="text-align: center;">Dimitri Baeli ( <a href="http://www.fermiersdacote.com">eXo Platform</a> )</p>
<p>Plus d&#8217;infos sur :<br />
<strong><a href="http://www.normandyjug.org">www.normandyjug.org</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=41</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla! &#8211; Inclure du PHP personnalisé sans Wrapper !</title>
		<link>http://blog.konkest.com/?p=30</link>
		<comments>http://blog.konkest.com/?p=30#comments</comments>
		<pubDate>Thu, 14 May 2009 13:52:58 +0000</pubDate>
		<dc:creator>finalspy</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[Joomla!]]></category>

		<guid isPermaLink="false">http://konkest.wordpress.com/?p=30</guid>
		<description><![CDATA[Pour tous ceux qui comme moi veulent réutiliser dans Joomla! leurs scripts PHP existant, ou rajouter vite fait des fonctionnalités sans pour autant coder leurs propres modules/composants, il y a des solutions pour inclure facilement votre code PHP perso dans un composant, dans un menu ou même dans un article !

Voici la solution que j&#8217;ai [...]]]></description>
			<content:encoded><![CDATA[<p>Pour tous ceux qui comme moi veulent réutiliser dans Joomla! leurs scripts PHP existant, ou rajouter vite fait des fonctionnalités sans pour autant coder leurs propres modules/composants, il y a des solutions pour inclure facilement votre code PHP perso dans un composant, dans un menu ou même dans un article !</p>
<p><span id="more-30"></span></p>
<p>Voici la solution que j&#8217;ai testé aujourd&#8217;hui et qui me parait plutôt pas mal : <br />
<div class="wp-caption aligncenter" style="width: 115px"><img alt="Logo JUMI" src="http://jumi.vedeme.cz/templates/ja_purity/images/logo.png" title="Logo JUMI" width="105" height="80" /><p class="wp-caption-text">Logo JUMI</p></div></p>
<p>Pour plus d&#8217;informations reportez vous soit :</p>
<ul>
<li><a title="Extension JUMI pour Joomla!" href="http://extensions.joomla.org/extensions/1023/details" target="_blank">Au site officiel d&#8217;extensions Joomla!</a></li>
<li><a title="Extension JUMI pour Joomla!" href="http://jumi.vedeme.cz/" target="_blank">Au site de Jumi</a></li>
</ul>
<p>Jumi permet 3 types d&#8217;inclusions :</p>
<ul>
<li>Via un composant</li>
<li>A l&#8217;emplacement d&#8217;un module</li>
<li>Dans un article</li>
</ul>
<p>L&#8217;avantage principale par rapport a l&#8217;utilisation d&#8217;un wrapper par exemple est que vos paramètres seront récupérables nativement dans votre code PHP.<br />
Autre gros avantage, pas d&#8217;iframe au comportement aléatoire et incertain parfois sur les héritages de styles etc.<br />
Par ailleurs dans le cas d&#8217;un composant, et d&#8217;un lien de menu pointant vers celui-ci, vous n&#8217;avez pas l&#8217;embêtement des URL absolues obligatoires.</p>
<p>Bref pour moi que du positif!<br />
Je pense même que, sauf pour du contenu externe, l&#8217;utilisation des wrappers va disparaitre de mes sites Joomla!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=30</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CMS et moteurs de blogs où est la limite ?</title>
		<link>http://blog.konkest.com/?p=7</link>
		<comments>http://blog.konkest.com/?p=7#comments</comments>
		<pubDate>Wed, 13 May 2009 22:12:45 +0000</pubDate>
		<dc:creator>finalspy</dc:creator>
				<category><![CDATA[CMS]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://konkest.wordpress.com/?p=7</guid>
		<description><![CDATA[Je viens de lire un article et des commentaires intéressants sur l&#8217;utilisation de Wordpress en tant que CMS et le pourquoi du comment :

Wordpress comme CMS ?
A méditer &#8230; car on y lit le point de vue de développeurs mais aussi d&#8217;utilisateurs finaux (ici des journalistes).
Personnellement je serai tenté de dire : &#171;&#160;et pourquoi pas [...]]]></description>
			<content:encoded><![CDATA[<p>Je viens de lire un article et des commentaires intéressants sur l&#8217;utilisation de Wordpress en tant que CMS et le pourquoi du comment :</p>
<p><span id="more-7"></span></p>
<p><a title="Wordpress comme CMS ?" href="http://blog.barbayellow.com/2009/04/20/presse-wordpress-comme-cms-et-pourquoi/" target="_blank">Wordpress comme CMS ?</a></p>
<p>A méditer &#8230; car on y lit le point de vue de développeurs mais aussi d&#8217;utilisateurs finaux (ici des journalistes).</p>
<p>Personnellement je serai tenté de dire : &laquo;&nbsp;et pourquoi pas ?&nbsp;&raquo;.<br />
Franchement a l&#8217;utilisation les CMS ce n&#8217;est pas toujours hyper pratique quand même. Pour les développeurs c&#8217;est rapidement la galère quand on veut faire quelque chose de spécifique, et parfois c&#8217;est a se demander si un bon vieux site &laquo;&nbsp;from scratch&nbsp;&raquo; ne serait pas sur les rails plus vite.<br />
Wordpress a l&#8217;avantage d&#8217;être plutôt simple côté prise en main, une énorme communauté anglophone, et pleins de possibilités niveau personnalisation du style.</p>
<p>Je serai curieux d&#8217;avoir vos opinions, et si vous vous êtes déjà posé la question de la limite entre blog et CMS, où la situeriez vous ? Qu&#8217;est ce qui justifie l&#8217;utilisation d&#8217;un CMS ? Et où un moteur de blog simple et performant est il plus approprié ?</p>
<p>La frontière ne me semble pas bien nette &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.konkest.com/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
