<?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>Spring Framework &#187; Quizz</title>
	<atom:link href="https://blog.developpez.com/spring/pcategory/spring-framework/quizz/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/spring</link>
	<description></description>
	<lastBuildDate>Wed, 27 Oct 2010 05:28:03 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Quizz Spring : InnerBean</title>
		<link>https://blog.developpez.com/spring/p5148/spring-framework/quizz/quizz_spring_innerbean</link>
		<comments>https://blog.developpez.com/spring/p5148/spring-framework/quizz/quizz_spring_innerbean#comments</comments>
		<pubDate>Fri, 22 Feb 2008 07:00:00 +0000</pubDate>
		<dc:creator><![CDATA[Hikage]]></dc:creator>
				<category><![CDATA[Quizz]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Petite nouveauté sur ce blog, je vais tenter de proposer chaque vendredi, une petite question pour tester vos connaissances du framework. Pour la première question, le sujet est la configuration des inner beans : Voici deux classes : public class OuterBean { &#160; &#160;InnerBean innerBean; &#160; &#160; &#160;// Getter / Setter &#160; } &#160; public class InnerBean {} Et un fichier de configuration XML : &#160; &#60;bean id=&#34;outerBean&#34; class=&#34;com.developpez.hikage.spring.core.OuterBean&#34;&#62; &#160; &#160; &#60;property name=&#34;innerBean&#34; &#62; &#160; [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>Petite nouveauté sur ce blog, je vais tenter de proposer chaque vendredi, une petite question pour tester vos connaissances du framework.</p>
<p>Pour la première question, le sujet est la configuration des inner beans :</p>
<p><span id="more-72"></span></p>
<p>Voici deux classes :</p>
<blockquote>
<pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">public class OuterBean { <br />
&nbsp; &nbsp;InnerBean innerBean; <br />
&nbsp;<br />
&nbsp; &nbsp;// Getter / Setter &nbsp;<br />
} <br />
&nbsp;<br />
public class InnerBean {}</div></div>

</pre>
</blockquote>
<p>Et un fichier de configuration XML :</p>
<blockquote><pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &lt;bean id=&quot;outerBean&quot; class=&quot;com.developpez.hikage.spring.core.OuterBean&quot;&gt; <br />
&nbsp; &nbsp; &lt;property name=&quot;innerBean&quot; &gt; <br />
&nbsp; &nbsp; &nbsp; &lt;bean id=&quot;innerBean&quot; scope=&quot;singleton&quot; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; class=&quot;com.developpez.hikage.spring.core.InnerBean&quot;/&gt; <br />
&nbsp; &nbsp; &lt;/property&gt; <br />
&nbsp; &lt;/bean&gt;</div></div>

</pre>
</blockquote>
<p>Que donnera l&rsquo;éxécution de ce code :</p>
<blockquote><pre>

<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ApplicationContext context = new ClassPathXmlApplicationContext(&quot;applicationContext-core.xml&quot;); <br />
&nbsp;<br />
&nbsp; &nbsp; try { <br />
&nbsp; &nbsp; &nbsp; OuterBean outer = (OuterBean) context.getBean(&quot;outerBean&quot;); <br />
&nbsp; &nbsp; &nbsp; InnerBean inner = (InnerBean) context.getBean(&quot;innerBean&quot;); <br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; if (outer.getInnerBean() == inner) { <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Inner = Outer.getInnerBean()&quot;); <br />
&nbsp; &nbsp; &nbsp; } else { <br />
&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(&quot;Inner != Outer.getInnerBean()&quot;); <br />
&nbsp; &nbsp; &nbsp; } <br />
&nbsp;<br />
&nbsp; &nbsp; } catch (BeansException e) { <br />
&nbsp; &nbsp; &nbsp; System.out.println(&quot;Erreur à l'éxécution&quot;); <br />
&nbsp; &nbsp; }</div></div>

</pre>
</blockquote>
<p>Essayez de répondre sans aller regarder la documentation <img src="https://blog.developpez.com/spring/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley" /></p>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
