<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1442099097036913606</id><updated>2011-07-28T06:05:24.462-07:00</updated><title type='text'>Sith Open Source</title><subtitle type='html'>Blogging about Open Source software I create</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://sithopensource.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://sithopensource.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Antony</name><uri>http://www.blogger.com/profile/02876015928926947789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_kl0df70KBgM/SQgoEYyvGII/AAAAAAAAAAM/Z0wLWxNFVko/S220/Captain-Tom-Paine.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1442099097036913606.post-8443697516292613322</id><published>2009-11-11T15:31:00.000-08:00</published><updated>2009-11-11T15:33:53.445-08:00</updated><title type='text'>Runtime bean wiring</title><content type='html'>Sproing provides an easy method of wiring an object into Spring at runtime when that object hasn't been created by Spring but needs access to Spring beans. &lt;br /&gt;&lt;br /&gt;The SpringWirer class provides a static method that, given an object, will wire it into the existing application context and set the spring beans needed &lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;public class Jedi { &lt;br /&gt;  private Force force; &lt;br /&gt;&lt;br /&gt;  public Jedi() { &lt;br /&gt;    // wire this object up &lt;br /&gt;    SpringWirer.wireBean(this); &lt;br /&gt;    force.push(); &lt;br /&gt;  } &lt;br /&gt;&lt;br /&gt;  // set the Force spring bean &lt;br /&gt;  public void setForce(Force force) { &lt;br /&gt;    this.force = force; &lt;br /&gt;  } &lt;br /&gt;&lt;br /&gt;} &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In this example, the Force object can be accessed because it is a bean defined in Spring. At runtime, the SpringWirer.wireBean(this) call will wire the object into Spring, setting the Force object using the setter method&lt;br /&gt;&lt;br /&gt;Sproing version 0.3.1alpha is available now from &lt;a href="http://www.sith.org.uk"&gt;Sith Open Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1442099097036913606-8443697516292613322?l=sithopensource.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sithopensource.blogspot.com/feeds/8443697516292613322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1442099097036913606&amp;postID=8443697516292613322' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/8443697516292613322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/8443697516292613322'/><link rel='alternate' type='text/html' href='http://sithopensource.blogspot.com/2009/11/runtime-bean-wiring.html' title='Runtime bean wiring'/><author><name>Antony</name><uri>http://www.blogger.com/profile/02876015928926947789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_kl0df70KBgM/SQgoEYyvGII/AAAAAAAAAAM/Z0wLWxNFVko/S220/Captain-Tom-Paine.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1442099097036913606.post-3084386657286235567</id><published>2009-10-29T08:14:00.000-07:00</published><updated>2009-10-29T08:18:27.175-07:00</updated><title type='text'>Sproing: Arbitrary Spring loading</title><content type='html'>Sometimes is is desirable to load spring when an arbitrary (ie, not containing a main() method) object is created. Sproing provides this for when another application is creating java objects in order to provide a route into your code (for example FitNesse, The Grinder etc) that you need to wire into spring. Sproing does this by loading any application context files you specify and then wiring the object into it, allowing you to inject beans at runtime.&lt;br /&gt;&lt;br /&gt;Spring beans are weired using the AutowireCapableBeanFactory.AUTOWIRE_BY_NAME strategy, so your object needs to have setter methods with the same names as the beans you want to wire up. You need to create a subclass of ApplicationWirer and implement the getPaths() method to return the paths of the spring application context files you want to wire up&lt;br /&gt;&lt;br /&gt;For example: &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  public class YourAppWirer extends ApplicationWirer { &lt;br /&gt;    public String[] getPaths() { &lt;br /&gt;      return new String[] { &lt;br /&gt;        "classpath:someApplicationContext.xml", &lt;br /&gt;        "classpath:applicationContext.xml"}; &lt;br /&gt;    } &lt;br /&gt;  } &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To wire up your object, all you need do is create a new instance of your overridden ApplicationWirer class in a constructor on your object, and call the wire() method&lt;br /&gt;&lt;br /&gt;For example, using YourAppWirer in the above example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  public class JediMindTrick { &lt;br /&gt;    public JediMindTrick() { &lt;br /&gt;      new YourAppWirer().wire(this); &lt;br /&gt;    } &lt;br /&gt;  } &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Provided you have defined public setter methods for any spring dependencies your object needs, and called them the same names as described above, spring will inject these at runtime. You can then write your object methods as normal&lt;br /&gt;&lt;br /&gt;Sproing version 0.3.1alpha is available now from &lt;a href="http://www.sith.org.uk"&gt;Sith Open Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1442099097036913606-3084386657286235567?l=sithopensource.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sithopensource.blogspot.com/feeds/3084386657286235567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1442099097036913606&amp;postID=3084386657286235567' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/3084386657286235567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/3084386657286235567'/><link rel='alternate' type='text/html' href='http://sithopensource.blogspot.com/2009/10/sproing-arbitrary-spring-loading.html' title='Sproing: Arbitrary Spring loading'/><author><name>Antony</name><uri>http://www.blogger.com/profile/02876015928926947789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_kl0df70KBgM/SQgoEYyvGII/AAAAAAAAAAM/Z0wLWxNFVko/S220/Captain-Tom-Paine.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1442099097036913606.post-5761644085755533285</id><published>2009-10-15T07:01:00.000-07:00</published><updated>2009-10-15T07:09:06.712-07:00</updated><title type='text'></title><content type='html'>&lt;span style="font-weight:bold;"&gt;Creating a Spring application&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Creating a standalone (ie non-web) application can seem a little confusing to some. &lt;span style="font-style:italic;"&gt;Sproing &lt;/span&gt;makes this easy by extending a &lt;span style="font-style:italic;"&gt;Sproing &lt;/span&gt;class and implementing a method, and that's it! &lt;br /&gt;&lt;br /&gt;All you need do is have your main (the class with the main() method that starts the application) extend &lt;span style="font-style:italic;"&gt;ApplicationWirer &lt;/span&gt;and implement the &lt;span style="font-style:italic;"&gt;getPaths()&lt;/span&gt; method that returns the path(s) to your application context xml files. Then a single call to the &lt;span style="font-style:italic;"&gt;wire()&lt;/span&gt; method does the rest &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;import uk.org.sith.sproing.spring.ApplicationWirer; &lt;br /&gt;public class Main extends ApplicationWirer { &lt;br /&gt;  public static void main(String[] args) { &lt;br /&gt;    Main main = new Main(); &lt;br /&gt;    main.wire(main); &lt;br /&gt;  } &lt;br /&gt;&lt;br /&gt;  public String[] getPaths() { &lt;br /&gt;    return new String[] {"applicationContext.xml"}; &lt;br /&gt;  } &lt;br /&gt;} &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This code will start your application and load the applicationContext.xml file into spring with all the spring beans defined. Easy! &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Sproing version 0.3.1alpha is available now from &lt;a href="http://sith.org.uk"&gt;Sith Open Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1442099097036913606-5761644085755533285?l=sithopensource.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sithopensource.blogspot.com/feeds/5761644085755533285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1442099097036913606&amp;postID=5761644085755533285' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/5761644085755533285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/5761644085755533285'/><link rel='alternate' type='text/html' href='http://sithopensource.blogspot.com/2009/10/creating-spring-application-creating.html' title=''/><author><name>Antony</name><uri>http://www.blogger.com/profile/02876015928926947789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_kl0df70KBgM/SQgoEYyvGII/AAAAAAAAAAM/Z0wLWxNFVko/S220/Captain-Tom-Paine.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1442099097036913606.post-4326637742335674430</id><published>2009-10-03T13:26:00.000-07:00</published><updated>2009-10-03T13:33:04.139-07:00</updated><title type='text'>Sproing: Spring static ApplicationContext access</title><content type='html'>It is often useful to gain access to the ApplicationContext object in order to locate existing beans. Sproing provides a ApplicationContextProvider class that can be used anywhere in a spring application to access the application context like so:  &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    ApplicationContext ctx = ApplicationContextProvider.getApplicationContext(); &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;If you have used Sproing to start the application and/or load Spring, you will automatically have access to this class. If you want to use this feature of Sproing in a web application, all you need to do is declare the ApplicationContextProvider as a spring bean in your spring xml file ie  &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    &amp;lt;bean id="applicationContextProvider" class="uk.org.sith.sproing.spring.ApplicationContextProvider"/&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Sproing version 0.3.1alpha is available now from &lt;a href="http://www.sith.org.uk"&gt;Sith Open Source&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1442099097036913606-4326637742335674430?l=sithopensource.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sithopensource.blogspot.com/feeds/4326637742335674430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1442099097036913606&amp;postID=4326637742335674430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/4326637742335674430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/4326637742335674430'/><link rel='alternate' type='text/html' href='http://sithopensource.blogspot.com/2009/10/sproing-spring-static.html' title='Sproing: Spring static ApplicationContext access'/><author><name>Antony</name><uri>http://www.blogger.com/profile/02876015928926947789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_kl0df70KBgM/SQgoEYyvGII/AAAAAAAAAAM/Z0wLWxNFVko/S220/Captain-Tom-Paine.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1442099097036913606.post-1845251813288123451</id><published>2009-09-02T15:07:00.000-07:00</published><updated>2009-09-02T15:09:43.104-07:00</updated><title type='text'>Sproing:  FitNesse-Spring integration</title><content type='html'>&lt;p&gt;Sproing wires up FitNesse fixtures into Spring by loading any application context files you specify and then wiring the fixture into it, allowing you to inject beans into the fixture at runtime.&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;&lt;p&gt;The fixture needs to implement SpringWirableFixture and extend your chosen FitNesse fixture. It is wired&lt;br /&gt;using the AutowireCapableBeanFactory.AUTOWIRE_BY_NAME strategy - it needs to do this to work properly with&lt;br /&gt;FitNesse, so your fixtures need to have setter methods with the same names as the beans you want to wire up&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You need to create a subclass of AbstractFixtureWirer and implement the getPaths() method to return the paths of the spring&lt;br /&gt;application context files you want to wire up&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   public class YourAppFixtureWirer extends AbstractFixtureWirer {&lt;br /&gt;   &lt;br /&gt;      public String[] getPaths() {&lt;br /&gt;   &lt;br /&gt;         return new String[] {&lt;br /&gt;                  "classpath:fitnesseApplicationContext.xml",&lt;br /&gt;                  "classpath:applicationContext.xml"};&lt;br /&gt;      }&lt;br /&gt;   &lt;br /&gt;   } &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;To wire up your fixture, all you need do is create a default constructor (or setUp() method if using a fixture that&lt;br /&gt;has one) and create a new instance of your overridden {@link AbstractFixtureWirer} class&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;For example, using YourAppFixtureWirer in the above example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;   public class TestFixture extends ColumnFixture implements SpringWirableFixture {&lt;br /&gt;   &lt;br /&gt;      public TestFixture() {&lt;br /&gt;         new YourAppFixtureWirer().wire(this);&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;FitNesse will call the default constructor, wiring up your fixture with the bean factory. Provided you have defined&lt;br /&gt;public setter methods for any spring dependencies your fixture needs, and called them the same names as described&lt;br /&gt;above, spring will inject these at runtime. You can then write your fixture methods as normal&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;It can be downloaded from &lt;a href="http://sourceforge.net/projects/sproing/"&gt;sourceforge&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1442099097036913606-1845251813288123451?l=sithopensource.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sithopensource.blogspot.com/feeds/1845251813288123451/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1442099097036913606&amp;postID=1845251813288123451' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/1845251813288123451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/1845251813288123451'/><link rel='alternate' type='text/html' href='http://sithopensource.blogspot.com/2009/09/sproing-fitnesse-spring-integration.html' title='Sproing:  FitNesse-Spring integration'/><author><name>Antony</name><uri>http://www.blogger.com/profile/02876015928926947789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_kl0df70KBgM/SQgoEYyvGII/AAAAAAAAAAM/Z0wLWxNFVko/S220/Captain-Tom-Paine.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1442099097036913606.post-8856738172436791921</id><published>2008-10-29T14:00:00.001-07:00</published><updated>2008-10-29T14:01:19.046-07:00</updated><title type='text'>Setting up</title><content type='html'>This blog is to post all the open source software I create, so others can find and use it&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1442099097036913606-8856738172436791921?l=sithopensource.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://sithopensource.blogspot.com/feeds/8856738172436791921/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1442099097036913606&amp;postID=8856738172436791921' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/8856738172436791921'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1442099097036913606/posts/default/8856738172436791921'/><link rel='alternate' type='text/html' href='http://sithopensource.blogspot.com/2008/10/setting-up.html' title='Setting up'/><author><name>Antony</name><uri>http://www.blogger.com/profile/02876015928926947789</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_kl0df70KBgM/SQgoEYyvGII/AAAAAAAAAAM/Z0wLWxNFVko/S220/Captain-Tom-Paine.png'/></author><thr:total>0</thr:total></entry></feed>
