Getting Started With LightWire
To get started with LightWire download the LightWire.cfc and the sample LightWireConfig.cfm from the SVN repository. You can place either file anywhere you want. I personally put the cfc in .com.lib (my library directory) and the config file in a "config" directory both of which are below my web root for a given project, but you can put the files anywhere you want.
Somewhere in your Application.cfc (in the onApplicationStart method) you’ll want to set the path to the LightWire config file path and then createobject LightWire. I currently just create it in application scope. Below is the config code I use which happens to use an application.CFMapping for the application specific mapping.
<cfset Application.LightWire = CreateObject("component","#application.CFMapping#.com.lib.LightWire").Init(Local.ConfigFilePath)>
You will want to customize the config file. See my recent posting on the syntax for that.
That is just about it. If you want to create an object (transient or singleton), just call LightWire and it will return the fully loaded object. Below are a couple of sample requests. If you want a singleton, use getSingleton(). If you want a transient, getTransient(). All you need to pass in is the name of the class you want to instantiate.
<cfset Request.PageService = Request.LightWire.getSingleton("PageService")>
<!--- Create PageObject --->
<cfset Request.PageObject = Request.LightWire.getTransient("PageObject")>
I could have created a single get() method as it would be easy to tell from the config file whether it was a singleton or a transient, but I decided I’d rather have a really explicit interface which would make it very obvious in my code what I was doing. Please also bear in mind that most objects will just be direct injected, so a lot of things like PageService and PageDAO won’t ever be explicitly called – they’ll just be injected into the appropriate controller cfcs so in practice you only need to call LightWire occasionally (pretty much wherever you'd have called ColdSpring plus wherever you'd have called your custom bean factories if you need DI into the beans).
If you are new to DI/IoC, start off by downloading ColdSpring. It has better documentation, more support and many more people using it. LightWire is for people who have explored ColdSpring and have decided they’d like an approach more optimized for DI into transient objects and/or because they like programmatic config files.
Any comments/thoughts much appreciated!

Great cooment, and good point - thanks. There are some cfc's that you only need to create once. In effect they act as function libraries which may also contain some "global" variables (although hidden within the cfc). Examples of this would be a UserService for interactive with users (when you want to get a list of users, for instance), or a UserDAO for holding the SQL to get users from a database. These objects can just be created once and effectively stored within the application scope (although that is hidden and handled by Lightwire). These are "singleton" objects because you only need a single object for each of these.
Transient objects are those which live for a shorter period of time and which you may well create multiple times. For instance, if you were to get a list of users from the database for a particular user request, you might want to encapsulate that recordset in an object. That would be a transient object as its only job is to take the user list from the model and to pass it to the view. At the end of the page request the object is thrown away and then if you want a list of users down the line, you'll go back to the UserService and it'll give you a new user colleciton with the appropriate recordset.
So, a singleton is typically created once for the life of an application whereas transients are created and disposed of much more frequently - often on a per request basis.
I am enjoying LightWire very much!
I am wondering though, should I scope all of my objects in the application or should I just call them in my controller when I need them? If it makes a difference, I am using Lazy Loading.
Glad you're enjoying! Of those two approaches, just call the objects from LightWire. Put l/w into app scope and if you want UserService just write: UserService = application.LightWire.getSingleton("UserService").
However, here is something to think about. Why don't you just use LightWire to create your controllers and then inject the service methods into the controllers using LightWire so you don't need to call LightWire at all in the controller?! That's how I'm doing things in LightBase and it seems to be working out pretty well.
First off, I'm not even sure how to use a controller as a cfc. I usually just have a .cfm page with a prefix and the name of the calling page and do all of my traffic control there.
Lets say you want to run the Cart controller. You'd say Cart = application.LightWire.get("Cart"). In your config file, you'd inject (say) product, cart and user services to the Cart controller (or whatever it needed). Then in the cart controller if you wanted to get product info you'd call ProductService.getbyID("CartProductID") and if you wanted to save your cart you'd do something like CartService.save(Cart). Does that make any sense?
I've wanted to go to using CFCs for my controllers for a long while, I just can't find any resources on learning to do so. I probably know enough already to do it, I just haven't really tried it yet and seeing some code would probably help get me over the edge.
You *could* make the controllers transient, but I don't keep any state in my controllers, so I treat them as singletons so I don't need to re-init them every time.
[url=http://www.lszwjx.com]????[/url] [url=http://www.lszwjx.com]?????[/url] [url=http://www.lszwjx.com]????[/url] [url=http://www.lszwjx.com/about.htm" target="_blank">http://www.lszwjx.com/about.htm]?????[/url] [url=http://www.lszwjx.com/about.htm" target="_blank">http://www.lszwjx.com/about.htm]?????[/url] [url=http://www.lszwjx.com/news.htm" target="_blank">http://www.lszwjx.com/news.htm]????[/url] [url=http://www.lszwjx.com/news.htm" target="_blank">http://www.lszwjx.com/news.htm]????[/url] [url=http://www.lszwjx.com/product.htm" target="_blank">http://www.lszwjx.com/product.htm]????[/url] [url=http://www.lszwjx.com/product2.htm" target="_blank">http://www.lszwjx.com/product2.htm]?????[/url] [url=http://www.lszwjx.com/plist493.htm" target="_blank">http://www.lszwjx.com/plist493.htm]?????[/url] [url=http://www.lszwjx.com/product2.htm" target="_blank">http://www.lszwjx.com/product2.htm]?????[/url] [url=http://www.lszwjx.com/plist490.htm" target="_blank">http://www.lszwjx.com/plist490.htm]?????[/url] [url=http://www.lszwjx.com/product2.htm" target="_blank">http://www.lszwjx.com/product2.htm]?????[/url] [url=http://www.lszwjx.com/plist495.htm" target="_blank">http://www.lszwjx.com/plist495.htm]?????[/url] [url=http://www.ruian2machine.cn]???[/url] [url=http://www.ruian2machine.cn]?????[/url] [url=http://www.ruian2machine.cn]?????[/url] [url=http://www.plastic-thermoforming-machine.com/product.htm]thermoforming Equipment[/url] [url=http://www.packagemachinery.cn]bag making machine[/url] [url=http://www.todesign.com.cn]????[/url] [url=http://www.todesign.com.cn]????[/url] [url=http://www.tzonegroup.cn]??[/url] [url=http://www.tzonegroup.cn/about.asp]??????[/url] [url=http://www.tzonegroup.cn/products.asp" target="_blank">http://www.tzonegroup.cn/products.asp]???[/url] [url=http://www.rajayj.cn]???[/url] [url=http://www.rajayj.cn]?????[/url] [url=http://www.ashuashi.com.cn]????[/url]
[url=http://www.gowowpowerleveling.com]power leveling[/url] [url=http://www.gowowpowerleveling.com]wow power leveling[/url] [url=http://www.zhongke-china.com]paper box[/url] [url=http://www.zhongke-china.com/about.asp]paper box equipment[/url] [url=http://www.plastic-thermoforming-machine.com]thermoforming Equipment[/url] [url=http://www.plastic-thermoforming-machine.com]Plastic Machinery[/url] [url=http://www.plastic-thermoforming-machine.com/about.htm" target="_blank">http://www.plastic-thermoforming-machine.com/about...]Plastic Machine[/url] [url=http://www.wzbtjx.cn]??[/url] [url=http://www.wzbtjx.cn]????[/url] [url=http://www.wzbtjx.cn]???[/url]
<a href="http://www.lszwjx.com">????</a> <a href="http://www.lszwjx.com">?????</a> <a href="http://www.lszwjx.com">????</a> <a href="http://www.lszwjx.com/about.htm" target="_blank">http://www.lszwjx.com/about.htm">?????</a> <a href="http://www.lszwjx.com/about.htm" target="_blank">http://www.lszwjx.com/about.htm">?????</a> <a href="http://www.lszwjx.com/news.htm" target="_blank">http://www.lszwjx.com/news.htm">????</a> <a href="http://www.lszwjx.com/news.htm" target="_blank">http://www.lszwjx.com/news.htm">????</a> <a href="http://www.lszwjx.com/product.htm" target="_blank">http://www.lszwjx.com/product.htm">????</a> <a href="http://www.lszwjx.com/product2.htm" target="_blank">http://www.lszwjx.com/product2.htm">?????</a> <a href="http://www.lszwjx.com/plist493.htm" target="_blank">http://www.lszwjx.com/plist493.htm">?????</a> <a href="http://www.lszwjx.com/product2.htm" target="_blank">http://www.lszwjx.com/product2.htm">?????</a> <a href="http://www.lszwjx.com/plist490.htm" target="_blank">http://www.lszwjx.com/plist490.htm">?????</a> <a href="http://www.lszwjx.com/product2.htm" target="_blank">http://www.lszwjx.com/product2.htm">?????</a> <a href="http://www.lszwjx.com/plist495.htm" target="_blank">http://www.lszwjx.com/plist495.htm">?????</a> <a href="http://www.ruian2machine.cn">???</a> <a href="http://www.ruian2machine.cn">?????</a> <a href="http://www.ruian2machine.cn">?????</a> <a href="http://www.plastic-thermoforming-machine.com/product.htm">thermoforming Equipment</a> <a href="http://www.packagemachinery.cn">bag making machine</a> <a href="http://www.todesign.com.cn">????</a> <a href="http://www.todesign.com.cn">????</a> <a href="http://www.tzonegroup.cn">??</a> <a href="http://www.tzonegroup.cn/about.asp">??????</a> <a href="http://www.tzonegroup.cn/products.asp" target="_blank">http://www.tzonegroup.cn/products.asp">???</a> <a href="http://www.rajayj.cn">???</a> <a href="http://www.rajayj.cn">?????</a> <a href="http://www.ashuashi.com.cn">????</a>
<a href="http://www.gowowpowerleveling.com">power leveling</a> <a href="http://www.gowowpowerleveling.com">wow power leveling</a> <a href="http://www.zhongke-china.com">paper box</a> <a href="http://www.zhongke-china.com/about.asp">paper box equipment</a> <a href="http://www.plastic-thermoforming-machine.com">thermoforming Equipment</a> <a href="http://www.plastic-thermoforming-machine.com">Plastic Machinery</a> <a href="http://www.plastic-thermoforming-machine.com/about.htm" target="_blank">http://www.plastic-thermoforming-machine.com/about...">Plastic Machine</a> <a href="http://www.wzbtjx.cn">??</a> <a href="http://www.wzbtjx.cn">????</a> <a href="http://www.wzbtjx.cn">???</a>
http://www.pvpvip.com
http://www.igcome.com
http://www.uggboots100.com
<a href="http://www.gamekoo.com/product/Sho_Online_MUN.html...">Sho Online Mun</a> is one of the hardest theme for every class at the beginning . You must have a good way to manage your <a href="http://www.gamekoo.com/product/Sho_Online_MUN.html...">Sho Mun</a>.If yor are a lucky guy ,you can earn so many <a href="http://www.gamekoo.com/product/Sho_Online_MUN.html...">Sho Online gold</a>
by yourself . But if you are a not , I just find a nice way to <a href="http://www.gamekoo.com/product/Sho_Online_MUN.html...">Sho gold</a>. If you need , you can buy <a href="http://www.gamekoo.com/product/Sho_Online_MUN.html...">buy Sho Online gold</a>
at our website . Go to the related page and check the detailed information . Once you have any question , you can connect our customer service at any time .
post. I will be your loyal reader. Thanks again.
old with a, something new, per say. Because the last touch that will meet. With honeymoon
post. I will be your loyal reader. Thanks again.
http://www.gucci-zone.com gucci outlet
http://www.ed-hardy-outlet.net/ ED Hardy Outlet
http://www.ed-hardy-outlet.net/ ED hardy clothing
http://www.dedhardy.com/ Ed Hardy Australia
http://www.dedhardy.com/ ED Hardy Clothing
Are you interested in any featured fashion replica watches?Do you instantly want to grab a famous brand replica breitling?If yes,then please buy replica hublot because replica omega are one of the most beautiful replica watches and innovative replica cartier in the worldwide replica breitling market most recently.That is why everyone is inclining towards trendy replica tag heuer nowadays.They are very distinctive fake watches, durable replica cartier,dependable replica tag heuer and affordable fake watches.Breitling replica omega contain vivid yet versatile colors,designs and logos that would attract to the eyes of every young man and woman on the dot.Currently replica breitling have become a huge symbol of fashion replica watches especially for the hot replica rolex,glamorous replica breitling and fashionable replica omega worldwide.They particularly buy replica watches so as to change their own appearance,shape and figures stunningly.That is why fashion replica rolex suit to the styles of the feminists always.
If you want to buy replica watches,you will have to make a quick research on replica rolex on the Google as you will go through a list of top replica breitling companies over there and choose your 100% professional company out of the all replica omega. Moreover replica watches are very comfortable fashion replica omega accessories.That is why replica breitling do not cause any sort of agony or depression to you at all.Stunningly online replica watches industry makes you available discounted replica omega globally.In short,Breitling replica breitling are very trendy,peaceful replica watches and lovable fashion replica omega accessories.replica breitling are very affordable,dependable replica watches and unique replica omega.That is why everyone is inclining towards cheap designer replica breitling nowadays so as to fulfill his or her modern day needs and desires matchlessly.Amazingly online fake watches shop offers you full color replica hublot worldwide in a most dedicated replica iwc,affordable replica watches and reliable replica omega.So please don't miss this replica breitling opportunity to buy your own unique replica watches at all.Come to our replica watches brand store.choose replica iwc and fake watches.Our best-sell replica iwc is replica audemar piguet.So I suggested!
http://www.coachoutletfactory.org/ coach factory outlet online
http://www.christian-louboutin-outlets.org/ christian louboutin
http://www.christian-louboutin-outlets.org/ christian louboutin outlet
http://www.coachoutletfactory.org/ coach bags
http://www.christian-louboutin-outlets.org/ christian louboutin shoes
<a href="http://miami.citysearch.com/profile/604378562/kend...">Locksmith Kendall</a>
http://www.outletcoach20l2.net coach outlet online
http://www.coachoutlet20l2.com coach outlet
http://www.coachs2011.com coach outlet online
http://www.juicycoutureoutlet2012.net juicy couture outlet online
http://www.outletcoach20l2.net Coach outlet store online
http://www.coachoutlet20l2.com Coach outlet online
http://www.coachs2011.com coach outlet store online