Self-Taught IT?

I love the premise of this article: Just because you are a Self-Taught Developer/IT Guy doesn’t make you any less authentic in your field than someone with a BS or an MS.

Planning vs. Acting is procrastination.  Just go after it.

via @DZone: 

With the high cost and low quality of College courses these days, it has surpassed the threshold of not being with the value it once offered.


Spring Application Context

For Command Line Apps

Some may find this so fundamental it is useless.  But since I make a practice of getting and using Spring Beans, not starting a Spring application from scratch, I have to write this stuff down for future – easy – access.

I need a reminder of grabbing my Spring Application Context outside of a web based application.  Normally I would just put a reference into my web.xml file:


But since I am running essentially a command-line process, I need to get a handle within the application itself.

1) Create a Singleton that will provide the context reference:
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
package com.fishizle.springsample;

import org.springframework.beans.BeansException;
import org.springframework.context.*;
import org.springframework.context.ApplicationContextAware;

public class ApplicationContextUtils implements ApplicationContextAware {

  private static ApplicationContext ctx;

  public void setApplicationContext(ApplicationContext appContext)
      throws BeansException {
    ctx = appContext;


  public static ApplicationContext getApplicationContext() {
      if (ctx == null) 
          ctx= new ClassPathXmlApplicationContext("SpringSample_annotations.xml");
    return ctx;
2) Next get a handle to the context
    private ApplicationContext ctx = ApplicationContextUtils.getApplicationContext();

In context of the functioning class:

public class Startup {

    private IncludeClass include1;
    private ApplicationContext ctx = ApplicationContextUtils.getApplicationContext();

    private Band band;

    private Thinker thinker;

    public static void main(String[] args) {
        System.out.println("Application Started Successfully");
        Startup startup = new Startup();

    public void goStartup() {
        include1 = (IncludeClass) ctx.getBean("include1");
        band = (Band) ctx.getBean("band");
3) Lastly, my app context XML::
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <bean id="contestantDelegate" class="com.fishizle.springsample.awards.GraciousContestant" ></bean>

       One Advantage of Spring aop: over @AspectJ is, Spring doesn't need Source files to AOP.  @AspectJ requires it.

        <aop:aspect ref="audience">
            <aop:pointcut id="performance" expression="execution(*" />

            <aop:before pointcut-ref="performance" method="takeSeats" />
            <aop:before pointcut-ref="performance" method="turnOffCellPhones" />
            <aop:after-returning pointcut-ref="performance" method="applaud" />
            <aop:after-throwing pointcut-ref="performance" method="demandRefund" />

            <aop:pointcut id="performance2" expression="execution (*" />

            <aop:around pointcut-ref="performance2" method="watchPerformance" />


        <aop:aspect ref="magician">
                    delegate-ref="contestantDelegate" />
            <!-- either default-impl   ... impl only for the Aspect
                 , or delegate-ref  ... Spring Bean reusable elsewhere  -->
            <!--default-impl="com.fishizle.springsample.awards.GraciousContestant" />-->

                (* com.fishizle.springsample.acts.Thinker.thinkOfSomething(String)) and args(thoughts)" />

            <aop:before pointcut-ref="thinking" method="interceptThoughts" arg-names="thoughts" />


    <context:annotation-config />
    <!--<context:component-scan />-->
    <bean id="include1" class="com.fishizle.springsample.IncludeClass"
          p:includeOneA-ref="include1a" />
        <!-- can specify list, set, map, properties as a p:property __ see page 48 Spring in Action -->

    <bean id="include1a" class="com.fishizle.springsample.Include1a" autowire="byName" />

    <!-- include2 -->
    <bean id="include2" class="com.fishizle.springsample.Include2" />

    <bean id="include3" class="com.fishizle.springsample.Include3" />

    <bean id="wireByName"
          p:inProp="My inProp" >

    <bean id="wireByType" class="com.fishizle.springsample.WireByType" autowire="byType" />

    <bean id="audience" class="" />

    <!-- The band -->
    <bean id="band" class="" />

    <bean id="bass" class="" />
    <bean id="drums" class="" />
    <bean id="guitar" class="" />
    <bean id="keyboard" class="" />
    <bean id="singing" class="" />

    <bean id="alex" class="" />
    <bean id="david" class="" />
    <bean id="eddie" class="" />
    <bean id="michael" class="" />

    <bean id="magician" class="com.fishizle.springsample.acts.mindReader.Magician" />
    <bean id="thinker" class="com.fishizle.springsample.acts.volunteers.VolunteerThinker" />

For the forgetful or unpracticed/un-exercised, I hope you find this quick reference useful.