killnine

/--[ The day I tried to learn Spring and Hibernate ]---------------------------\
|                                                                              |
|                                                                              |
|                          /\/\/\/\/\/\/\/\/\/\/\/\/\/\                        |
|                         (                            )                       |
|                         (  I'm tired of not knowing  )                       |
|                         (  Java. Today is the day I  )                       |
|                         (  will sit here and learn   )                       | 
|                         (  how to develop webapps    )                       |
|                         (  with Spring and Hibernate )                       |
|                         (                            )
|                          \/\/\/\/\/\/\/\/\/\/\/\/\/\/                        |
|                                                                              |
|                                              (   )                           |
|                                                                              |
|                                                ( )                           |
|                                                                              |
|                                                  ()                          |
|                                                             \\/\\\//         |
|                                                             |      |         |
|                                                            (^)(^)--3         |
|                                               --------      |      |         |
|   [Prof. Hibernate ]                          \  ___  \ > > | ---  |    ~    |
|   [Spring in Action]                           \_______\ \ \ \____/    [ ]=  |
|----------------------                     ------------------------------------
|----------------------                     ------------------------------------ 
|                   | |                    | |          ------     |           |
|                   | |                    | |          |  --------|           |
|                   | |                    | |             |                   |
--------------------------------------------------------------------------------
| First I created a greeting service interface                                 |
--------------------------------------------------------------------------------
|                                                                              |
|    package com.springinaction.chapter01.hello;                               |
|    public interface GreetingService {                                        |
|      public void sayGreeting();                                              |
|    }                                                                         |
|                                                                              |
--------------------------------------------------------------------------------
|                                                                              |
|                                                             \\/\\\//         |
|                                                             |      |         |
|                                                            (-)(-)--3         |
|                                               --------      |      |         |
|   [Prof. Hibernate ]                          \  ___  \ > > | --\  |    ~    |
|   [Spring in Action]                           \_______\ \ \ \____/    [ ]=  |
|----------------------                     ------------------------------------
|----------------------                     ------------------------------------ 
|                   | |                    | |          ------     |           |
|                   | |                    | |          |  --------|           |
|                   | |                    | |             |                   |
--------------------------------------------------------------------------------
| Then I created a class to implement the greeting service                     |
--------------------------------------------------------------------------------
|                                                                              |
| package com.springinaction.chapter01.hello;                                  |
|                                                                              |
| public class GreetingServiceImpl implements GreetingService {                |
|   private String greeting;                                                   |
|                                                                              |
|   public GreetingServiceImpl() {}                                            |
|                                                                              |
|   public GreetingServiceImpl(String greeting) {                              |
|      this.greeting = greeting;                                               |
|   }                                                                          |
|                                                                              |
|   public void sayGreeting() {                                                |
|      System.out.println(greeting);                                           |
|   }                                                                          |
|                                                                              |
|   public void setGreeting(String greeting) {                                 | 
|      this.greeting = greeting;                                               |
|   }                                                                          |
| }                                                                            |
|                                                                              |
--------------------------------------------------------------------------------
|                                                                              |
|                                                             \\/\\\//         |
|                                                             /\ /\  |         |
|                                                            (-)(-)--3         |
|                                               --------      |      |         |
|   [Prof. Hibernate ]                          \  ___  \ > > | ---  |    ~    |
|   [Spring in Action]                           \_______\ \ \ \____/    [ ]=  |
|----------------------                     ------------------------------------
|----------------------                     ------------------------------------ 
|                   | |                    | |          ------     |           |
|                   | |                    | |          |  --------|           |
|                   | |                    | |             |                   |
--------------------------------------------------------------------------------
| Then I created an XML configuration file                                     |
--------------------------------------------------------------------------------
|                                                                              |
                                                                               |
| <?xml version="1.0" encoding="UTF-8"?>                                       |
| <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"                             |
|    "http://www.springframework.org/dtd/spring-beans.dtd">                    |
|                                                                              |
| <beans>                                                                      |
|    <bean id="greetingService"                                                |
|          class="com.springinaction.chapter01.hello.GreetingServiceImpl">     |
|       <property name="greeting">                                             |
|          <value>Hello World!</value>                                         |                     
|     </property>                                                              |
|    </bean>                                                                   |
| </beans>                                                                     |
|                                                                              |
--------------------------------------------------------------------------------
|                                                                              |
|                                                             \\/\\\//         |
|                                                             |      |         |
|                                                            (?)(?)--3         |
|                                               --------      |      |         |
|   [Prof. Hibernate ]                          \  ___  \ > > | --\  |    ~    |
|   [Spring in Action]                           \_______\ \ \ \____/    [ ]=  |
|----------------------                     ------------------------------------
|----------------------                     ------------------------------------ 
|                   | |                    | |          ------     |           |
|                   | |                    | |          |  --------|           |
|                   | |                    | |             |                   |
--------------------------------------------------------------------------------
| Then I created a class to retrieve the greeting service                      |
--------------------------------------------------------------------------------
|                                                                              |
| package com.springinaction.chapter01.hello;                                  |
|                                                                              |
| import java.io.FileInputStream;                                              |
| import org.springframework.beans.factory.BeanFactory;                        |
| import org.springframework.beans.factory.xml.XmlBeanFactory;                 |
|                                                                              |
| public class HelloApp {                                                      |
|   public static void main(String[] args) throws Exception {                  |
|      BeanFactory factory =                                                   |
|         new XmlBeanFactory(new FileInputStream("hello.xml"));                |
|                                                                              |
|      GreetingService greetingService =                                       |
|         (GreetingService) factory.getBean("greetingService");                |
|                                                                              |
|       greetingService.sayGreeting();                                         |
|   }                                                                          |
| }                                                                            |
|                                                                              |
--------------------------------------------------------------------------------
| Then I shot myself in the face                                               |
--------------------------------------------------------------------------------
|                                                                              |
|                                                                              |
|                                                                   ~  / / /   |
|                                                          ____  / ~~(>)(>) ~  |
|                                               --------  | __() --  ~\  \ \   |
|   [Prof. Hibernate ]                          \  ___  \ | | --\  ~  / / /~   |
|   [Spring in Action]                           \_______\ \ \    ~ / / /      |
|----------------------                     ------------------------------------
|----------------------                     ------------------------------------ 
|                   | |                    | |          ------     |           |
|                   | |                    | |          |  --------|           |
|                   | |                    | |             |                   |
--------------------------------------------------------------------------------
\---------------------------------------------[ http://www.killnine.com ]------/

/--[ comics ]------------------------------------------------------------------\

03.11.2008 - [0027] Celebrity Worship at the SXSW Interactive Conference
01.17.2008 - [0026] People who take themselves too seriously
03.30.2007 - [0025] A summary of Mark Zuckerberg's speech at Startup School
03.07.2007 - [0023] Who needs white strips?
03.07.2007 - [0022] Tiresome conversations
03.06.2007 - [0021] Dreamer
03.02.2007 - [0020] No one ever responds to my personal ads
03.01.2007 - [0019] Stop software abuse
02.28.2007 - [0018] Steve's Debris
02.27.2007 - [0017] Programming Styles Compared
02.26.2007 - [0016] What Would Jay-Z Do?
02.24.2007 - [0015] My brain is a dumb terminal
02.21.2007 - [0014] What if Camus were a Computer Scientist?
02.21.2007 - [0013] Memorization vs. Understanding
02.20.2007 - [0012] An elegant proof of determinism
02.20.2007 - [0011] A tribute to geeks 
02.20.2007 - [0010] Getting p0wned by your girlfriend 
02.19.2007 - [0009] I don't understand social networking
02.19.2007 - [0008] Don't judge a book by its cover
02.19.2007 - [0007] The day I tried to learn Spring and Hibernate
02.18.2007 - [0006] Sometimes I hate web standards evangelists
02.18.2007 - [0005] Last year I quit my job to become an online poker player
02.18.2007 - [0004] Graffiti in the math building
02.17.2007 - [0003] Every geek's fantasy: Meeting a girl in a wi-fi cafe
02.17.2007 - [0002] What happens when you think in terms of computer programs
02.17.2007 - [0001] It's hard to answer questions honestly at work in your 20's

\--[ rss ]-------------------------------[ killnine comics at gmail dot com ]--/