Found: The day I tried to learn Spring and Hibernate
In the wake of the big discussion on designing for testability and average developers, I stumbled across this toon:
/--[ 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 ]------/
One funny thing is that I own both the books sitting on the poor guy's desk: Java Persitence with Hibernate
and Spring in Action
Comment Notification
If you would like to receive an email when updates are made to this post, please register here
Subscribe to this post's comments using