Matt RaibleMatt Raible is a writer with a passion for software. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.
You searched this site for "matt". 1,142 entries found.

You can also try this same search on Google.

Happy Birthday Mom!

For the last couple weeks, I've been enjoying a great Christmas vacation in Oregon with most of my family. Abbie and Jack didn't join me, but they got to spend 3 weeks in West Palm Beach, Florida. Poor kids.

Mom on Playa Carrillo I made sure the end of my vacation would land on a very special person's birthday. My Mom. Not only is my mom one of the coolest people in the world, she also has an excellent job title: Burn Boss. Growing up in Montana, I was always proud that Barb Raible was my mom. She was famous for her kindness in the Swan Valley. I hope she's always famous for her story about nailing a bear's nuts to a tree.

My mom is a Montana Native who wasn't afraid to raise her kids in the backwoods at her family's homestead. It sounds like a crazy idea to me, but she made it happen - cooking over a wood stove every day and working at the Swan Valley Ranger Station to make ends meet. She was responsible for getting us out of Montana and onto Oregon. She went back to school in her early 40s, got a degree in Forestry from the University of Montana and moved the whole family to Oregon for a job with the BLM.

I moved to Oregon on June 14, 1990 driving a '73 Plymouth Duster with a homemade International trailer in tow. We certainly looked like we were from Montana when we rolled into town. We moved into a house on Felony Flats. My sister and I got jobs at McDonald's (Dad's advice) and started school at North Salem High school in the fall. I met many good friends at North Salem - Jess, Matt, Clint and Michelle becoming favorites over the years.

Sunrise in Bend For New Years, Jess, Clint and I rented a condo in Bend, Oregon. Matt joined us on Friday after most of us experienced an Epic Powder Day at Mt. Bachelor. It was the first time we'd all been together in 9 years. We had a blast.

This vacation in Oregon has been very special to me. I've reunited with many old friends, enjoyed 2 epic powder days and had a great time with my Mom, Dad, Sister and her fiancé Mya.

As much fun as I've had, I'm looking forward to getting back to Denver and hanging out with my kids. January 2009 is sure to be one for the books. I start a new gig at a new office tomorrow. On Wednesday, the kids return from Florida to a mountain of presents at my house. My parents are coming to town next weekend, followed by a trip to Tahoe and a weekend in Steamboat to finish out the month.

Yeah, 2009 is going to be a lot of fun. Maybe I'll see you on the slopes. ;-)

Posted in General at Jan 04 2009, 12:08:28 PM MST Add a Comment

2008 - A Year in Review

In 2005 and 2006, I did "A Year in Review" entries. 2007 was the year I got divorced, which probably motivated me to write a bit less. This year I'm back and ready to spend the next few hours writing, copying/pasting and linking like a madman. Hope you enjoy!

Workin' on the Feedlot 2008 was the year I traveled the world and developed a true passion for skiing. In January, my good friend Jason Miller moved back to Denver after quitting his job at Bear Stearns in NYC. We spent the first weekend in Nebraska working on Cletus's feedlot. The next week, my car stereo got stolen and I wondered if my bad knee would make it through the ski season (the good news is not only did I ski the rest of the season, but my knee healed itself over the summer).

Abbie and Jack on Green Mountain At the end of January, the kids and I hiked to the top of Green Mountain and Don Brown made Maven not suck. Then I wondered if there was room for both Rails and Grails at a company and quickly learned both.

February started fantastically with a 14" Powder Day at Steamboat. I wondered if there is no "best" web framework and reviewed Grails and Rails books. After spending an awesome weekend in Tahoe, I took the kids on The Ski Train and learned more about Selenium at Google.

Breathtaking Miller and Vial Lake Tahoe - Last Run

This brings us to one of my favorite posts of all time. On February 28th, Jack got a bead stuck in his nose. After taking him to the ER and paying $800, we found out magic recipe for bead removal is to "hold one nostril and give him a CPR-type breath/blow into his mouth". The reason I love the post so much is it's solved the problem for other frantic parents when they Google for "bead stuck in nose". Whenever I get a new comment, it always makes me smile.

March started out with a Powder Day at Whistler. I thoroughly enjoyed the rest of the weekend with good friends Jarvis and Korn Dog. After returning to Denver, I was allowed to blog about building a UI Frameworks Team at LinkedIn and posted my thoughts on Grails vs. Rails.

View from Our Condo In mid-March, I achieved an all-Mac family and traveled to Lake Chelan for my sister's birthday. Shortly after, The AppFuse Primer was released. At the end of the month, I attended TSSJS in Vegas and moderated a Web Framework Smackdown.

In April, the LinkedIn Denver office opened and we all celebrated by attending the Rockie's Home Opener. The ski season came to an end and I wrote a howto for configuring Apache with mod_proxy and SSL on OS X. Then I discovered the JavaOne parties and wrote about running Spring MVC Web Applications in OSGi.

April ended with 82°F and May started with snow. I attended JavaOne (or at least the parties), released AppFuse 2.0.2 and figured out how to do extensionless URLs with the UrlRewriteFilter. The kids and I spent an afternoon in Rocky Mountain National Park and I did some coding in my backyard.

Jack's Special Rock Nice Trail Beautiful Smile Here's Hoping for another run in October

On Memorial Day, I enjoyed a liver-wrenching, Rockies-filled weekend with my sister her girlfriend Mya and Mr. Miller. I also contemplated making AppFuse Struts 2-specific.

June started with some mountain bike riding, planning some excellent vacations and getting a dream machine. I rode the annual trip to Big Head Todd at Red Rocks with Matt and Bruce. I took the kids on their first camping trip for Father's Day and had a blast. It took us several hours to find the campsite and my car kept starting all night long. It's sure to be a family tradition from now on.

Catchin' Bugs

The next weekend, I attended the American Craft Beer Fest in Boston. To end the month, I embarked upon Raible Road Trip #12 with Abbie, Jack and my Dad.

Grand Tetons In July, the bus project began and I posted pictures of the trip to Montana. This year, I hope to spend the whole month of July at the cabin. I bought an iPhone (one of my best technology-related purchases to date). OSCON was fun but the week after wasn't.

Nice 'n Snug August revealed my favorite birthday present. I didn't blog much the rest of the month, revealing why later.

Jack on his 4th Birthday Jack's Birthday Weekend was an outstandingly fun mixture of old friends and good Colorado beer. In September, I went to see the bus at MotorWorks, Abbie lost her first tooth and co-workers and I performance tested Memcached.

What followed was wonderful. Miller and I headed to Oktoberfest for the Best. Vacation. Ever. We still talk about how much fun we had on that vacation. October finished with the Colorado Software Summit and a hunting trip to the cabin.

November was a crazy month. I got laid off and celebrated Abbie's birthday on the same day. Jack got a mohawk and I traveled coast-to-coast in the same week. To close the month, I announced what's next and headed to Costa Rica.

Costa Rica, courtesy of Rob Misek

I had a fantastic time in Costa Rica and was impressed to see Abbie is a blue skier shortly after. I did a Dojo/Comet Research Project for a week and enjoyed the location of my newest client last week. A small adventure turned into a scary adventure and I enjoyed telling my stories to fellow Java Enthusiasts in Portland.

Phew! It's been quite a year. For 2009, I'm still hoping for what I tweeted shortly after Costa Rica. I'd like to visit 3 foreign countries, take 3 months of vacation and spend 1 month in Montana. I have technology goals too, but those aren't nearly as much fun to dream about. ;-)

Happy New Year!

Posted in Roller at Dec 31 2008, 04:56:32 PM MST 2 Comments

My "almost slept in a snow cave" Adventure with Clint Foster

Yesterday began innocently as one of the best ski days of my life. I woke up early, drove to Eugene (Oregon) to pick up my good friend Clint Foster, then headed up to Willamette Pass. It was an Epic Powder Day with over 2 feet of fresh pow pow and face shots on almost every run. After lunch and some liquid courage, we stepped it up a notch and skied some cornices and awesome trees.

Getting ready for a Cornice Jump Epic Powder Day Willamette Pass

Around 2:30, our luck began to change. In our quest for untracked powder, Clint led us off the back side of Willamette Pass. There were no out-of-bounds signs or ropes to indicate this was a bad idea. The steep tree run we found was great, but our attitude changed quickly when we reached the bottom.

With 2 feet of snow and no trail, we found ourselves trudging down a flat path that got us nowhere fast. For two hours, we slogged through the deep snow down a cross-country ski trail (there were blue signs with arrows). As we started to pass the 2nd lake (I believe they were called Rosary Lakes), we decided it was time to bite the bullet and turn around. We had no map or compass. If we kept going in our current direction, we didn't know when (or if) we'd get out. If we turned around, we knew it would take 4-5 hours, but at least we knew it would get us out. "And besides", Clint said, "the trail is already broken." The time was 4:30 and it was starting to get dark.

Yes, the trail was broken, but it wasn't broken for hiking sideways up the mountain we'd skied down. We couldn't take our skis off because we'd immediately sink up to our waste in the snow. It was slow going, sometimes only a step or two at a time. If I wasn't sweating and breathing hard, I'd start to get cold and shiver. We were soaked on the outside from the snow and soaked on the inside from sweating. It was snowing pretty good too, so we knew we might lose our trail if we dug a snow cave and spent the night.

The scariest part happened when we were about an hour from getting out. Clint started to cramp up and it seemed for moment that we were destined to spend the night in a snow cave. While it was his idea to take the trail, he was the reason I made it out last night. He broke trail for most of the hike out. I tried, but would get tired so quickly it didn't help much. So when he, the trail breaker, started to cramp up, it began to look grim. I don't know if it was the thought of sleeping in a snow cave or because we could see the top of the ridge, but Clint's cramps subsided and we were able to make it out. We ended up on a groomed run and had to hike another 45 minutes to get to the top of the mountain and ski down the front-side.

As for Search and Rescue, they were looking for us, but had only recently started searching. The resort had night-skiing and it wasn't until 9:00 that anyone thought we might be missing. Clint's wife, Autumn, was on the ball and had contracted the authorities to inspire their search. We couldn't have asked for a better concerned relative. Autumn is a special person who has a way of making things happen. If we'd spent the night in a snow cave, there's a good chance she would've had the National Guard looking for us the next day.

We made it back to the car just after 10 PM. We first started our run at 2:30 PM. From the point we turned around, it took about 5 hours to hike out. I've never been so tired after a day of skiing. We arrived back at Clint's place just after midnight after a 2-hour drive in the blowing snow and rain. Autumn greeted us with warm clothes, hot tea and the best hugs I've gotten in a long time.

If you ever get a chance to meet Clint and Autumn, I'd highly recommend it. They're the ones who got married in Costa Rica recently. As far as skiing with Clint, that's fun too, but I wouldn't recommend following him out-of-bounds. ;-)

Posted in General at Dec 27 2008, 11:58:54 AM MST 7 Comments

Dojo/Comet support in Java Web Frameworks

Dojo Logo This week I'm doing a research project for a client. The main purpose of the project is to find out which Java-based web framework works best with Dojo and Comet. Here's the key requirement from the client:

It's all about Comet, we want Comet everywhere we can put it, but we want to isolate the icky bits of fiddling with pages with JavaScript. We're kind of wed to the Dojo implementation of the client-side bit, so we may as well use more of the Dojo widgets for a richer UI. For us, "works best with" needs to pay a certain amount of consideration to "fits naturally with", if you understand what I mean. I know that any framework that lets you spit out raw HTML will let you hand code in your Dojo / Comet, but that's certain to become very tiresome very quickly.

The candidate frameworks they asked me to look at are Wicket and Tapestry 5. They're willing to upgrade to Struts 2 since they're already using Struts 1. However, they don't feel that action-based frameworks naturally lead to rich UIs, so they'd prefer a component-based framework. They're currently using Seam for an administration-type application and feel it's too heavy for their customer-facing application.

Here's what I've found so far in my research. Please let me know if anything is incorrect.

  • Tapestry 5 doesn't have Dojo or Comet support (Prototype and Scriptaculous are the baked-in Ajax frameworks).
  • Struts 2 has old (version 0.4.3) and somewhat deprecated Dojo support. The developers seem to be in favor of removing it and promoting people hand-code Dojo instead. Struts 2 doesn't have support for Comet.
  • Wicket has support for Dojo 1.1 that includes Comet support. This was written by Stefan Fußenegger and posted to the mailing list last month. I e-mailed Stefan and asked him about documentation. His response: "I lost my ambition to document it properly since I didn't receive any feedback on the mailing list. :)"

At this point, it seems that if the client really wants to use Dojo, they should use Wicket, and possibly pay Stefan to document it properly. However, they're willing to consider other options, as long as they have Comet support.

One option I thought of is to use DWR and its Reverse Ajax/Comet support. Another option would be to add better Dojo support to Tapestry 5. However, I don't think this is possible since the Prototype/Scriptaculous code is generated by the framework and would likely require a changes to switch it to Dojo.

Are there any other Java-based web frameworks that support easily creating Dojo widgets and working with Comet? Keith Donald tweeted that Spring MVC has Dojo support. However, I believe it's only for widgets and it still requires you to write JavaScript. If your framework doesn't have Dojo/Comet support, how hard would it be to add it?

Update: I also posted this question on LinkedIn. Make sure and check my question for additional thoughts from folks.

Posted in Java at Dec 18 2008, 03:58:37 PM MST 19 Comments

How I recovered data from my failed Linux box

Yesterday, I decided to quit procrastinating and finish up my 2007 taxes once and for all. When I booted up QuickBooks on my XP box, it said it couldn't connect to drive Q. Drive Q is on my Linux box, which I discovered wasn't on. When I booted it, the screen showed an "Error 18" after the GRUB loading message. The resulted in several hours of grub-install and many other commands to no avail.

Since I hadn't messed with the box in almost a year, I didn't even know if it had Fedora or Suse installed on it. I had both disks lying around, so I tried the good ol' linux rescue with my Fedora disks. I was able to access the data, but had no luck in getting network connectivity or copying files to a USB drive.

Today I hoped for a different route: Live CDs. Yesterday, I discovered I was running Suse 10, so I downloaded a Suse 11 Live CD, burned it and booted. It worked, but I didn't have access to my hard drives and wasn't able to mount anything. Next up, I tried Knoppix, which allowed me to boot and access my hard drives. Unfortunately, I still didn't have any network access and my 2GB thumb drive didn't hold enough data.

Next, I pulled out a 250GB USB drive I had lying around. Knoppix recognized it, but was unable to format it for some reason. I plugged it into my XP box, used fat32format to format the drive as FAT32, and plugged it back into my Linux box. Success! I was able to copy all the data I needed and now I have the USB drive plugged into my Airport Extreme.

Hopefully if someone else runs into similar issues, they can use this post to find their path to success.

Posted in Open Source at Dec 11 2008, 02:02:29 PM MST 6 Comments

Costa Rica was Awesome!

After entering The Golden Period almost two weeks ago, I boarded a flight bound for Costa Rica early on the morning of Thanksgiving. I knew Costa Rica was going to be a great time since good friends (the bride and groom, Autumn and Clint) and my parents were going.

My Room at Villa Pacande On Thursday night, I had a room booked at Villa Pacande. As they suggested on their website, I took an Orange cab (for $4, not $22 like the driver tried to tell me) to my hotel. 30 minutes later I ended up at the Hotel Pacande and quickly negotiated for another cab to the Villa Pacande. 30 minutes later, I was swinging in a hammock on my room's balcony. As you can see from the picture on the right, it was a pretty nice room. I enjoyed the sunset, tipped back a few cold ones and waited for my friends to arrive at 11. After they arrived, we stayed up until the wee hours of the morning and had a fun time sharing old memories.

On Friday, we boarded a private bus that transported us from the Villa to Hotel Esperanza. It was pretty nerve-racking watching our driver navigate the narrow roads at high speed for 5 hours. We safely arrived in Playa Carrillo on Friday afternoon and soon after walked 10 minutes to the local beach. As we were walking there, my parents showed up in their rental car (they'd been in Panama for the week). Soon after, we saw some monkeys in trees then ran for the beach and splashed around in the waves of the Pacific. We entered darkness to a beautiful sunset that evening.

Monkeys Playa Carrillo Mom and Dad in Costa Rica

Sunset in Playa Carrillo Sunset in Playa Carrillo Sunset in Playa Carrillo

On Saturday, I woke up early (6:30), went on a run with my mom (very hot when the wind disappeared), had a dip in the pool and enjoyed a delicious breakfast from Dennis, the host of Hotel Esperanza. I should probably talk about the hotel a bit since that was one of the best parts. Hotel Esperanza is owned by an American (Dennis) from Florida and he and his right-hand man (Erwin) provided some of the best service I've ever seen at a hotel. The hotel had 7 rooms, and our wedding party took up 6 of them. The bride and groom occupied one, I had one, the maid of honor (Angie) had one and the other 3 were occupied by parents (mine + parents of the bride and groom). We had the place all to ourselves and it was simply magnificent.

After breakfast, we headed down to Jesse's Gym for some surfing lessons. We were told to come back at 2:30 when the tide was good. We walked down the beach to Samara and had some lunch while we waited. After lunch, 5 of us got surfing lessons and had a blast. I'm definitely hooked on surfing now and hope to get some more practice in when I make trips out to LA this winter.

Happy Fellas Beach like Glass Beautiful Beach near Samara

Wipeout! Nice Ride! No Comment

Sunday was the wedding day and we started things off by taking a horseback ride in the pouring rain. It was a warm rain, so the ride itself wasn't bad. The lack of views at the top of the mountain wasn't too great though.

Giddyup! Riding in the Rain Autumn and Clint in Costa Rica

For the wedding ceremony, all the guys traveled down to the local beach and built an altar. The ceremony was a couple hours later and we had a ball toasting, eating and dancing the night away. At the end of the night, after everyone else had crashed, Angie and I walked down to the beach with a bottle of wine and enjoyed a spectacular site: 15-20 boats that were glowing in the distance off the shore. Sure, it could've been the booze, but I'm pretty sure it wasn't. ;-)

Happy Wife You May Kiss the Bride! Goofy

On Monday morning, people started to head their different directions. Clint's parents were staying another week, so they rented a car and headed north. Clint and Autumn jumped on a bus to enjoy their honeymoon in many different parts of Costa Rica. Autumn's parents hopped on a shuttle to San Jose to catch a flight back home. The rest of us (my parents, Angie and I) stayed at Hotel Esparanza for one more night. Angie and I got massages, napped by the pool and enjoyed one last walk on the beach. Tuesday was spent driving back to San Jose. We dropped Angie off at Hotel Pacande and boarded a plane for Panama City.

After arriving in Panama City, we rented a car and drove to Ivan's Bed and Breakfast (highly recommended) for the night. On Wednesday morning, we toured the Miraflores Locks (part of the Panama Canal) and drove to our friends' house in El Valle. In El Valle, we talked, read, relaxed and watched it rain. A lot. It was a nice way to wind down the trip before flying back last Friday.

Ivan's in Panama Ivan's Bed and Breakfast Panama

Mom and Dad at Miraflores Locks At The Panama Canal Big Cargo Ship

My favorite part of this vacation was enjoying the beautiful beaches with really cool people. Good friends are always fun to party with, especially when they bring along other good friends. I love destination weddings and I'm pumped to enjoy two more in 2009: one in West Palm Beach and one in Cancun.

It's a strange feeling being back in the snow after surfing last week. Hopefully I'll get over it soon. Skiing last weekend was good therapy. 5 more days before the end of the year and I should be fully recovered.

For more pictures from this trip, see my Costa Rica 2008 set on Flickr.

Posted in General at Dec 10 2008, 12:39:24 AM MST 3 Comments

What's Next

It's been three weeks since I joined the realm of the unemployed. Fortunately, I didn't stay unemployed for long. In fact, after writing the aforementioned post, I received 5 offers the next day. Of the opportunities I received, the most interesting ones were those from companies interested in hiring the whole team. Not only that, but LinkedIn hired me back as a contractor through the end of the year. The goal of the LinkedIn contract: finish up projects that my team had started in the previous months.

At the end of the first week after the LinkedIn layoffs, we all had individual opportunities, but we also had two team opportunities. The following week (last week), I flew to NYC to meet with one potential client while the other potential client flew to Denver to meet with the rest of the team. After flying to NYC, I traveled to Mountain View to do some on-site work at LinkedIn. At the end of the week, it seemed like most of the remaining tasks at LinkedIn could be done by someone else. I told them I thought it was best that I move onto other things, while staying available for support questions. On the way to the airport, I spoke with both our team opportunities. Following those conversations, I was very pumped about both projects and confident about pending offers. You can imagine my disappointment when my flight was delayed for 5 hours.

After a fun weekend with Abbie, Jack and friends, I woke up Monday morning without a job and it felt great. However, things changed quickly. Monday morning many opportunities landed in my inbox: a 3-day gig this week (helping write open-source training), a 1-week gig in December (evaluating how well Tapestry 5, Wicket and Struts 2 integrate with Dojo/Comet for a client in Europe), a 1-week training gig in Europe next year and a 3-month gig for the whole team. I accepted all these opportunities and am very happy I'll get to work with Jimbo, Country and Scotty again next year. The 3-month gig should be a lot of fun. We're helping build a SOFEA-based architecture that leverages appropriate client technologies (to be determined) to build a kick-ass web application. I look forward to talking about the technologies we use and things we learn along the way.

Costa Rica, courtesy of Rob Misek So the good news is I've entered The Golden Period. The Golden Period is when you don't have a job, but you do have a start date. Unemployment is absolutely blissful during this time. The Golden Period exists a couple times for me over the next 6 weeks.

I'll be traveling to Costa Rica tomorrow for a best friend's wedding. I'm leaving both my laptop and my iPhone at home. Next week, I'll be loving life with my parents in Costa Rica and Panama. The following week, I'll be working on AppFuse all week and hope to make great progress on developing 2.1. Then I have the 1-week Web Framework Analysis gig, followed by 2 weeks of vacation in Oregon. My Golden Period begins this afternoon (for 3 weeks) and happens again over Christmas (for 2 weeks).

Yeah, life is good. Damn good. :-D

Posted in Java at Nov 26 2008, 03:19:18 PM MST 12 Comments

LinkedIn Cuts 10% (a.k.a. The Journey is Over)

This morning, my co-workers and I discovered that LinkedIn decided to trim 10% of its employees. The Denver Office was among those that were laid off. I can't say we didn't see the writing on the wall. In fact, on the evening of October 15, I sent the following e-mail to my co-workers:

LinkedIn's top investor[1] is Sequoia Capital and they recently posted this presentation on the web.

http://www.slideshare.net/eldon/sequoia-capital-on-startups-and-the-economic-downturn-presentation?type=powerpoint

Notice the reduce head count recommendations. ... Oh well, life goes on. ;-)

Raible

[1] http://www.linkedin.com/static?key=investors

So, as of today, there is no LinkedIn Denver office. While I had a lot of fun being a UI Architect and managing Engineers, I'm somewhat happy this has happened. After all, now I get to enjoy the best perk about being an employee: the good ol' severance package!

If you're looking for good Engineers, I highly recommend all of the guys who worked for me during this journey. You can read more about the skills they possess and what they're looking for by viewing their LinkedIn Profiles:


Scott Nicholls

Bryan Noll

James Goodwill

As for me, I'm definitely in the market as well. You can view My LinkedIn Profile to see if I might be a good fit for your organization. I'm willing to travel up to 25%, but would prefer not to. After all, ski season is right around the corner. ;-)

Lastly, I just wanted to say that I really enjoyed working at LinkedIn. I've never worked with a smarter group of Engineers, nor been so excited about a company's product and vision. I know that LinkedIn will be highly successful and I hope to use their site to find gigs for many years to come.

Posted in Java at Nov 05 2008, 03:10:06 PM MST 16 Comments

Moving from Spring's XML to Annotations in AppFuse

Last night, I did a spike on AppFuse to change XML to Spring annotations (@Repository, @Service and @Autowired) in its service and data modules. While I was able to accomplish everything in a few hours (including converting tests), I did run into a couple issues.

AbstractTransactionalJUnit4..Tests vs. AbstractTransactionalDataSource..Tests
I've switched from my favorite Spring class to the annotation-happy AbstractTransactionalJUnit4SpringContextTests. However, this has presented an issue: when using ATDSSCT, I was able to call endTransaction() and startNewTransaction(). With ATJ4SCT, this doesn't seem possible. Below is a screenshot of the diff on a test method in the JPA implementation of UserDaoTest:

AbstractTransactionalJUnit4SpringContextTests vs. AbstractTransactionalDataSourceSpringContextTests

On the right, you'll notice that I had to comment out @ExpectedException to get the test to pass. This concerns me since this exception should be thrown. Is there a way to call endTransaction() and startNewTransaction() when subclassing AbstractTransactionalJUnit4SpringContextTests?

Instantiating GenericDao Implementations Programmatically
The second feature I tried to add is the ability to instantiate a GenericDao programatically rather than requiring a XML bean definition. In current versions of AppFuse, you can use the following bean definition to create a GenericDao for a model object.

<bean id="personDao" class="org.appfuse.dao.hibernate.GenericDaoHibernate">
    <constructor-arg value="org.appfuse.tutorial.model.Person"/> 
    <property name="sessionFactory" ref="sessionFactory"/>
</bean> 

When moving to a no-XML required architecture, it'd be nice to allow users to create GenericDao's programmatically. Below is the easiest way I've found to do this in a test:

GenericDao<User, Long> genericDao;
@Autowired
SessionFactory sessionFactory;

@Before
public void setUp() {
    genericDao = new GenericDaoHibernate<User, Long>(User.class);
    genericDao.setSessionFactory(sessionFactory);
}

However, there's a couple problems with this. First of all, mixing constructor injection and setter injection probably isn't a good idea. Changing the constructor to take a SessionFactory solves this problem, but now all subclasses need to have a more verbose constructor:

@Autowired
public UserDaoHibernate(SessionFactory sessionFactory) {
    super(User.class, sessionFactory);
}

Whereas before they had:

public UserDaoHibernate() {
    super(User.class);
}

In an ideal world, I could call new GenericDaoHibernate<User, Long>(User.class) and the SessionFactory would be wired in auto-magically. Is this possible with Spring 2.5?

The 2nd problem this presents is your client code will now be dependent on an implementation rather than the interface. I don't know how to solve that one, but I'd love to figure out a way to create GenericDaos with no XML and no implementation details in the client. Any ideas are most welcome.

If you'd like to see all the changes I made in converting from XML to Annotations, please see this patch.

Posted in Java at Nov 04 2008, 11:39:54 AM MST 14 Comments

AppFuse Light » AppFuse, Maven Archetypes and Shared Web Assets

Last night, I stayed up into the wee hours of the morning working on something I've been wanting to do for a long time. It wasn't until I was trouncing around the woods in Montana that I realized how easy it would be. The something I've wanted to do was to modify AppFuse Light to use AppFuse's core modules (service and dao). It only took me a few hours to make it happen and it inspired additional ideas.

I believe the major mistake we made in AppFuse 2.x was making it easy for user's to upgrade their applications. We currently use the maven-war-plugin and our own maven-warpath-plugin to make it possible to include AppFuse classes and assets in your project. You can easily start a new project w/o having a whole bunch of files in your project. The problem is, you can't easily use "mvn jetty:run" to work on your project. Of course, you can use "mvn appfuse:full-source" to solve this, but I'm starting to think more and more that "full-source" should be the default. This is what we did in 1.x and it seems to be the more natural pattern for folks using AppFuse.

That hard part about moving to "full-source" by default is coming up with a way to share common assets and classes among wars and war projects. Sure, I can copy all the shared images, css and js into each project - but that could become a maintenance nightmare. Subversion 1.5 with relative svn:externals might solve this, but it still seems kinda hacky. I don't want to use the maven-war-plugin because the overlay is kinda hokey and I think it's easier for users to understand when everything is in their project. AppFuse's current directory structure in SVN looks as follows. I've added indicators of what is in each directory.

AppFuse Web SVN

Rather than using AppFuse's current (manual) archetype-creation process, I'd like to move to a more automated creation process using the maven-archetype-plugin's create-from-project feature. I'd like to figure out a way where I can have the source code and assets from web/common included in each of the other web/* projects (both when using "jetty:run" and "archetype:create-from-project"). One idea I thought of is to make Jetty/Maven aware of multiple src/war directories for "jetty:run" and "package" and then somehow hook into the archetype plugin at creation time to pull in the shared resources. I don't know if something like this is possible. If you know of a good solution to this shared web assets issue, I'd love to hear about it.

Back to AppFuse Light. If I can figure out how to solve shared resources in web modules, I can use this in AppFuse Light to move to a modular SVN structure vs. its current "use Ant to create different combinations" setup. If a modular structure (like appfuse/web/*) is possible for AppFuse Light, I believe it makes sense to move its source into AppFuse's SVN repository. Below is how the directory structure might look after this move.

AppFuse Light » AppFuse

With this addition and "archetype:create-from-project", we should be able to create all the basic and light archetypes automatically. We'll probably still need a manual archetype-creation process for modular archetypes, but I'm OK with that.

The last thing I'm struggling with is figuring out the best way to create archetypes for something like AppFuse. In the past, we've used dependencies to allow users to inherit dependencies and their versions. This works, but it results in a lot of duplicate XML (in projects and archetypes) for developers. Last night, I tried using a parent project instead of dependencies and it seems to work much better. Not only do you inherit dependencies, but you also inherit plugins, profiles and properties. If you inherit, you can override, which is slick.

If you're an AppFuse user, how would you feel about having an AppFuse module as your project's parent? Would you prefer that, dependencies on AppFuse or full-source with no dependencies on AppFuse? Regardless of parent vs. dependencies, I think running "appfuse:full-source" should allow you to de-couple your project from AppFuse.

Posted in Java at Oct 29 2008, 02:18:59 AM MDT 7 Comments