<?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>Source Rebels&#187; Code</title>
	<atom:link href="http://www.sourcerebels.com/blog/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sourcerebels.com/blog</link>
	<description>Por Edu Rodríguez Castillo</description>
	<lastBuildDate>Sat, 03 Jul 2010 06:03:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Spring MVC y Spring Security</title>
		<link>http://www.sourcerebels.com/blog/spring-mvc-y-spring-security/</link>
		<comments>http://www.sourcerebels.com/blog/spring-mvc-y-spring-security/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 09:13:59 +0000</pubDate>
		<dc:creator>Edu</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Spring]]></category>
		<category><![CDATA[Spring MVC]]></category>

		<guid isPermaLink="false">http://www.sourcerebels.com/blog/?p=353</guid>
		<description><![CDATA[En este post voy a explicar cómo proteger una aplicación Spring MVC utilizando el módulo Spring Security. Se trata de una guía muy ràpida y para nada seria. Se parte de la base de que tenemos un proyecto web Maven recien generado Dependencias a añadir al fichero pom.xml de Maven. 1 2 3 4 5 [...]]]></description>
			<content:encoded><![CDATA[<p>En este post voy a explicar cómo proteger una aplicación Spring MVC utilizando el módulo Spring Security. Se trata de una guía muy ràpida y para nada seria. Se parte de la base de que tenemos un <a href="http://maven.apache.org/guides/mini/guide-webapp.html">proyecto web Maven</a> recien generado <img src='http://www.sourcerebels.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Dependencias a añadir al fichero pom.xml de Maven.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td 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<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>2.5.6.SEC01<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-webmvc<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>2.5.6.SEC01<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>commons-lang<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>commons-lang<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>2.4<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>javax.servlet<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>servlet-api<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>2.5<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.security<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-security-core<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>2.0.5.RELEASE<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;type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/type<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;scope<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>compile<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scope<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></td></tr></table></div>

<p>Modificaciones de /WEB-INF/web.xml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;">&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Listener que inicializa el contexto 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>
    <span style="color: #808080; font-style: italic;">&lt;!-- Ubicación del fichero de configuración 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>/WEB-INF/applicationContext.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>
    <span style="color: #808080; font-style: italic;">&lt;!-- Dispatcher Servlet --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>springapp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.web.servlet.DispatcherServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>springapp<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>*.htm<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Filtro de Spring Security que intercepta las llamadas a las URL de</span>
<span style="color: #808080; font-style: italic;">         la aplicación --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>springSecurityFilterChain<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.web.filter.DelegatingFilterProxy<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>springSecurityFilterChain<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filter-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Contenido de /WEB-INF/applicationContext.xml</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
</pre></td><td 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:p</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/p&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;">xmlns:security</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/security&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">        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</span>
<span style="color: #009900;">        http://www.springframework.org/schema/security</span>
<span style="color: #009900;">        http://www.springframework.org/schema/security/spring-security-2.0.4.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Configuración del acceso a las diferentes URL de la aplicación en función del</span>
<span style="color: #808080; font-style: italic;">         rol del usuario. En este caso toda la aplicación está protegida y se requiere</span>
<span style="color: #808080; font-style: italic;">         de un usuario con rol ROLE_USER para acceder --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:http</span> <span style="color: #000066;">auto-config</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:intercept-url</span> <span style="color: #000066;">pattern</span>=<span style="color: #ff0000;">&quot;/**&quot;</span> <span style="color: #000066;">access</span>=<span style="color: #ff0000;">&quot;ROLE_USER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/security:http<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Algunos usuarios de prueba. Posteriormente podremos cambiar el servicio para</span>
<span style="color: #808080; font-style: italic;">         que vaya a buscar la información de los usuarios a otro lugar (BBDD) --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:authentication-provider<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:user-service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:user</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;admin&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;admin&quot;</span> <span style="color: #000066;">authorities</span>=<span style="color: #ff0000;">&quot;ROLE_USER, ROLE_ADMIN&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:user</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;user1&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;user1&quot;</span> <span style="color: #000066;">authorities</span>=<span style="color: #ff0000;">&quot;ROLE_USER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:user</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;user1&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;user1&quot;</span> <span style="color: #000066;">authorities</span>=<span style="color: #ff0000;">&quot;ROLE_USER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/security:user-service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/security:authentication-provider<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<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></td></tr></table></div>

<p>Una vez hecho esto, al acceder a cualquier recurso de la aplicación se nos mostrará la pantalla de login por defecto de Spring Security. Otro día veremos cómo personalizar esta página de login. Os dejo con una captura de la página:</p>
<p><a href="http://www.sourcerebels.com/blog/wp-content/uploads/2010/06/spring-security-mvc-login-screen.png"><img src="http://www.sourcerebels.com/blog/wp-content/uploads/2010/06/spring-security-mvc-login-screen.png" alt="" title="spring-security-mvc-login-screen" width="444" height="315" class="aligncenter size-full wp-image-357" /></a></p>
<p>Un saludo</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sourcerebels.com/blog/spring-mvc-y-spring-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pair Programming</title>
		<link>http://www.sourcerebels.com/blog/pair-programming/</link>
		<comments>http://www.sourcerebels.com/blog/pair-programming/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 11:25:15 +0000</pubDate>
		<dc:creator>Edu</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Best-Practices]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.sourcerebels.com/blog/?p=346</guid>
		<description><![CDATA[¿Por qué no se practica pair-programming (programación por parejas) en las empresas? Las ventajas, pensándolo detenidamente 5 minutos saltan a la vista: Cuatro ojos ven más que dos. Esto es evidente. El código generado es de mucha más calidad. El hecho de que alguien supervise directamente nuestro trabajo (nuestra pareja de programación) influye en que [...]]]></description>
			<content:encoded><![CDATA[<p>¿Por qué no se practica pair-programming (programación por parejas) en las empresas?</p>
<p>Las ventajas, pensándolo detenidamente 5 minutos saltan a la vista:</p>
<ul>
<li>Cuatro ojos ven más que dos. Esto es evidente. El código generado es de mucha más calidad.</li>
<li>El hecho de que alguien supervise directamente nuestro trabajo (nuestra pareja de programación) influye en que nos esforcemos más.</li>
<li>Dos personas comparten la responsabilidad de una tarea. El stress es menor.</li>
<li>Mejora las relaciones de equipo.</li>
<li>Amplifica la transmisión del conocimiento.</li>
</ul>
<p>La excusa para no utilizarla que siempre he escuchado es la misma:</p>
<blockquote><p>&#8220;¿Cómo voy a tener a dos personas haciendo una tarea cuando podría hacerla una única persona?&#8221;.</p></blockquote>
<p>Normalmente esta gente suele ser la misma que ve a los programadores, no como una persona o un profesional, sino como un gasto en la cuenta de su proyecto y mi consejo: alejate de esta gente como de la peste <img src='http://www.sourcerebels.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sourcerebels.com/blog/pair-programming/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Control de versiones con Git</title>
		<link>http://www.sourcerebels.com/blog/control-de-versiones-con-git/</link>
		<comments>http://www.sourcerebels.com/blog/control-de-versiones-con-git/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 12:34:16 +0000</pubDate>
		<dc:creator>Edu</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[VCS]]></category>

		<guid isPermaLink="false">http://www.sourcerebels.com/blog/?p=260</guid>
		<description><![CDATA[Últimamente ando bastante engorilado con Git, por lo que este post pretende ser una introducción muy rápida de las cuatro cosillas que estoy aprendiendo sobre este VCS estos días. En siguientes entradas, o lo que es lo mismo sólo $DEITY sabe cuando, muy probablemente escribiré como montar un repositorio Git utilizando el servicio gratuito ofrecido por github.com. En primer lugar [...]]]></description>
			<content:encoded><![CDATA[<p>Últimamente ando bastante engorilado con <a title="Git VCS" href="http://git-scm.com/" target="_blank">Git</a>, por lo que este post pretende ser una introducción muy rápida de las cuatro cosillas que estoy aprendiendo sobre este <a title="VCS" href="http://en.wikipedia.org/wiki/Revision_control" target="_blank">VCS</a> estos días. En siguientes entradas, o lo que es lo mismo sólo $DEITY sabe cuando, muy probablemente escribiré como montar un repositorio Git utilizando el servicio gratuito ofrecido por <a title="Github.com" href="http://www.github.com/" target="_blank">github.com</a>.</p>
<p>En primer lugar indicar que Git es un sistema distribuido, a diferencia de por ejemplo Subversion o CVS que son centralizados. Esto para nosotros qué quiere decir? Básicamente que no trabajamos con una copia local del código fuente sino con una copia local o clon del repositorio original, más conocido como &#8220;master&#8221;.<br />
Las ventajas más importante de trabajar de esta forma, siempre bajo mi punto de vista, son que disponemos de todas las utilidades propias del VCS sin ni siquiera tener que estar conectado a una red. Muy útil para acceder al historico de modificaciones de un fichero, comparar versiones, hacer un commit o cualquier cosa que hagas normalmente con tu VCS desde un sitio donde no dispongas de conexión.</p>
<p>Git define también 5 tipos de objetos alguno de los cuales nos serán familiares si hemos trabajado con un VCS antes:</p>
<ul>
<li><strong>Blob:</strong> El contenido de un fichero gestionado por Git e identificable por el Hash SHA1 que se obtiene del dicho contenido.</li>
<li><strong>Tree:</strong> La estructura del repositorio en un momento determinado (normalmente un commit). Un objeto de tipo Tree tiene N objetos de tipo Blob asociados.</li>
<li><strong>Commit:</strong> Una &#8220;foto&#8221; del repositorio una vez se han introducido una serie de cambios. Un objeto de tipo commit tiene 1 objeto de tipo Tree asociado.</li>
<li><strong>Tag:</strong> Una etiqueta, normalmente sirve para marcar objetos de tipo commit.</li>
<li><strong>Índice:</strong> Imagen de los cambios que se aplicarán al repositorio en el siguiente commit. En Git, por defecto sólo aplican aquellos cambios que se encuentran reflejados en este índice (están STAGED).</li>
</ul>
<p>Git a diferencia que otros VCS como Subversion no almacena únicamente los cambios de un fichero sino que almacena el contenido completo de cada revisión. Esto sumado a la forma de trabajar que tiene con los objetos que indiqué antes hacen que en general el funcionamiento de Git sea muy ágil y, bajo mi punto de vista, mucho menos susceptible a error (piensa que cada vez que le pides una revisión en concreto, Git no debe &#8220;montarla&#8221; sólo &#8220;localizarla&#8221;).</p>
<p>Sólo por estas cosillas, ya comienzo a estar tentado de cambiar. ¿Habeis trabajado con Git o similar? ¿Qué os parece? ¿Cambiaríais vuestro Subversion/CVS?</p>
<p>Por cierto el libro que estoy leyendo es &#8220;<a title="Version Control with Git" href="http://oreilly.com/catalog/9780596520137" target="_blank">Version Control with Git</a>&#8221; de la editorial O&#8217;Reilly Media por si alguien quiere echarle una leída.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sourcerebels.com/blog/control-de-versiones-con-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My top recomentations for new programmers</title>
		<link>http://www.sourcerebels.com/blog/my-top-recomentations-for-new-programmers/</link>
		<comments>http://www.sourcerebels.com/blog/my-top-recomentations-for-new-programmers/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 11:00:26 +0000</pubDate>
		<dc:creator>Edu</dc:creator>
				<category><![CDATA[Best-Practices]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://www.sourcerebels.com/blog/?p=250</guid>
		<description><![CDATA[Unsorted list: If you use a versioning control system, spend some time learning its basic usage (checkout, checkin, update, diff, merge, &#8230;). If you don&#8217;t use it, go quickly to get one. Im currently using svn and git. Don&#8217;t be scared about refactoring your code. Write your own documentation. Document your work for your personal [...]]]></description>
			<content:encoded><![CDATA[<p>Unsorted list:</p>
<ul>
<li>If you use a versioning control system, spend some time learning its basic usage (checkout, checkin, update, diff, merge, &#8230;). If you don&#8217;t use it, go quickly to get one. Im currently using <a title="Subversion" href="http://subversion.tigris.org/" target="_blank">svn</a> and <a title="Git" href="http://git-scm.com/" target="_blank">git</a>.</li>
</ul>
<ul>
<li>Don&#8217;t be scared about <a title="Code refactoring" href="http://en.wikipedia.org/wiki/Refactoring" target="_blank">refactoring</a> your code.</li>
</ul>
<ul>
<li>Write your own documentation. Document your work for your personal profit. While you are documenting and organizing you are thinking in your job by looking it from a different point of view. Think in documentation like in a software-piece, it must be useful and reusable.</li>
</ul>
<ul>
<li>Constantly, try to improve your knowledge about every day tools usage by knowing its internals (keyboard shorcuts or processes) or just learning from your colleages (or Internet users) usage.</li>
</ul>
<ul>
<li>Write <a title="Test automation" href="http://en.wikipedia.org/wiki/Automated_testing" target="_blank">automated tests</a> and execute it. You can use <a title="Continuous Integration" href="http://martinfowler.com/articles/continuousIntegration.html" target="_blank">continuous integration</a> for doing the job. I like the <a title="Hudson" href="http://hudson-ci.org/" target="_blank">Hudson CI server</a>.</li>
</ul>
<ul>
<li>Don&#8217;t be IDE-dependent for your compilation, use scripts or tools specifically designed for this task. Actually <a title="Apache Maven" href="http://maven.apache.org/" target="_blank">Maven</a> will be my first choice because Java is my main plattform.</li>
</ul>
<ul>
<li>Get feedback about your code. Show them into colleagues or use communities like <a title="StackOverflow" href="http://stackoverflow.com/" target="_blank">StackOverflow</a>.</li>
</ul>
<ul>
<li>Learn what <a title="KISS" href="http://en.wikipedia.org/wiki/KISS_principle" target="_blank">KISS</a> and <a title="Convention over configuration" href="http://en.wikipedia.org/wiki/Convention_over_configuration" target="_blank">Convention over configuration</a> means. Be aware about <a title="Overengineering" href="http://en.wikipedia.org/wiki/Overengineering" target="_blank">overengineering</a>.</li>
</ul>
<ul>
<li>Don&#8217;t try to write your own framework or libraries for later use. Learn writing it  if you want, but use well-known community libraries or frameworks. I personally work mainly with <a title="Spring Framework" href="http://www.springsource.org/" target="_blank">Spring Framework</a> and Apache commons.</li>
</ul>
<ul>
<li>Backup your data. Use your own/preferred method. I personally like <a title="Dropbox" href="https://www.dropbox.com/" target="_blank">dropbox</a>.</li>
</ul>
<ul>
<li>Most important. Don&#8217;t try to acomplish all of this at same time. Just be patient and <img src='http://www.sourcerebels.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>Please, feedback <img src='http://www.sourcerebels.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sourcerebels.com/blog/my-top-recomentations-for-new-programmers/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
