Matt RaibleMatt Raible is a Web Developer and Java Champion. 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.

AppFuse a top 10 java.net project?

AppFuse I don't know if it's really a top 10 project, but it gets lots of hits, accesses and mail traffic. Nice! I'm willing to bet it's the cool logo that's the source of its popularity. ;-)

BTW, I'm giving a talk on AppFuse at Denver's No Fluff Just Stuff in two weeks. If I can finish up the "appgen" tool by then, the talk could be a lot more fun as the demo would be short and sweet. I doubt it'll happen though. I'm knee deep in creating a version of AppFuse Light that showcases how to use Spring with Hibernate and your choice of web framework: Struts, Spring, WebWork, Tapestry or JSF. I hope to release it sometime this weekend or early next week. Next week (and likely the week after), I have to write Chapter 10 of Spring Live. That leaves almost no time for creating the next cool tool. Who knows though - it might be easier than I think - especially since Lance submitted a good start.

Posted in Java at Oct 29 2004, 09:49:17 PM MDT 2 Comments

Trails - like Rails, but with Tapestry, Spring and Hibernate

I've been thinking about Rails ever since I wrote a post about it on Monday. The main reason is because of Dion's comment:

Matt - You should follow the lead and do a video of setting up a simple app using AppFuse.

This might sounds like a good idea, but if I did it right now in AppFuse's current state, it'd be a disaster. The reason? Because you have to manually create a whole bunch of classes to do CRUD on a database table. Here's a list of new classes needed for adding a new "person" table.

  • model.Person
  • dao.PersonDAOTest
  • dao.PersonDAO
  • dao.hibernate.PersonDAOHibernate
  • service.PersonManagerTest
  • service.PersonManager
  • service.impl.PersonManagerImpl
  • webapp.action.PersonActionTest
  • webapp.action.PersonAction
  • web/pages/personList.jsp
  • web/pages/personForm.jsp

The last two JSPs can be generated, but that's still a buttload of classes (9) just to CRUD (and test!) a database table. Not too mention all the files you need to edit for Spring and i18n.

  • dao/hibernate/applicationContext-hibernate.xml
  • service/applicationContext-service.xml
  • test/web/web-tests.xml
  • web/WEB-INF/classes/ApplicationResources_en.properties
  • web/WEB-INF/menu-config.xml

Result: to CRUD a database table using AppFuse you have to create 11 new files and modify 5 existing files. 16 files. What a beotch, huh? If I made a video of this - it'd be 20 minutes long! While this might make AppFuse look silly, it's really more of a symptom of the patterns we have in J2EE and how we're supposed to architect our apps. 3 tiers, test-driven, loosely-coupled and internationalized. Of course, if I was focused on fast and efficient, I could do this all with 1 JSP and JSTL's SQL tags. Everyone would slap my hand for not following patterns, but I'm willing to bet it'd work just as well and be just as fast. But I digress.

There have been a fair amount of requests (and some patches submitted) to generate and modify all of the files listed above. For the most part, I've frowned upon adding such a feature because I think if folks can run "ant generate -Dmodel=Person" - they'll end up with a whole bunch of code that they know nothing about. Sure there's the tutorials, but folks will quit reading those. Instead, they'll create a whole slew of POJOs (maybe even using Middlegen) and run "ant generate" on all 50 of them. Poof - now they've got 550 new files to maintain. Talk about a maintenance nightmare. Even worse - a support nightmare for me.

Nevertheless, if I wanted to create a cool video for AppFuse, I'd spend a few days writing this code-generation engine. Then I could show how you could create the data, service and web layer (including UI) in a matter of seconds. It'd be cool and folks would dig it. I'm still considering it, but I'm also leary of the resulting support fiasco. Maybe I could just say "use at your own risk". ;-)

A while back, I saw Erik Hatcher suggest a better solution than code-generation. I can't remember what he called it, but it was something like "meta-data dynamic rendering". The idea is that your application reads the metadata of a table (or POJO) and renders the appropriate UI for it. I loved the idea as soon as I heard it. I've always wanted a way to dynamically render the UI rather than writing HTML. Of course, I still want the ability to edit the templates and HTML since I fancy that sort of stuff. I don't like writing HTML for each row in a form, but I do like tweaking the HTML and CSS to look good.

Earlier this week, I saw the concept in action with Rails and its demo. IMO, something like Rails would never fly in Java because it appears to be tightly coupled to the database and only MySQL, PostgreSQL, and SQLite are supported. The Java community always seems to pride itself on database abstraction, partly due to JDBC and its ability to connect to anything that has a JDBC Driver. Ruby will probably catch up someday, but right now it appears to be looking for something like JDBC.

Then along comes Trails, which made me smile earlier today when I first read about it on the tapestry-dev mailing list.

I've been working on a project called Trails that uses Tapestry quite heavily and I thought it time to start soliciting feedback. Trails is a domain driven development framework that uses Tapestry, Spring, and Hibernate. Trails is very much in it's infancy, but the current version is functional and should give people a rough idea where I am heading. It's my first real forray into Tapesty and I have really found Tapestry a joy to work with.

Trails is very much like Rails, except that it doesn't talk directly to a database table. Instead, it talks to your domain objects that you mark up with XDoclet/Hibernate tags. To test it out, I dropped a User.java file into the org.trails.demo package, marked it up with XDoclet and deployed. It didn't work at first because the .hbm.xml files are explicitly listed in Spring's applicationContext.xml. I changed the "sessionFactory" bean to use the following and wammo - success! I could list and CRUD the table that my User object was mapped to.

  <property name="mappingDirectoryLocations">
    <list>
      <value>classpath:</value>
    </list>
  </property>

Trails is very cool, and I'd love to incorporate it into AppFuse or Equinox. Does an LGPL license allow me to do this? The one problem I can see with adding it is that it's specific to Tapestry and Hibernate, which doesn't always suite folks. I think developers might be willing to change because this solution will vastly improve their development productivity, but who knows. I think the best solution would be to offer this option in AppFuse/Equinox, but also offer the current manual and code-generation options. The holy grail would be the ability to plug in iBATIS or JDO instead of Hibernate. In addition, using Struts, Spring, WebWork or JSF instead of Tapestry would have folks clammering to use this stuff.

Mad props to David Heinemeier Hansson and Chris Nelson - you guys are developing awesome software.

Posted in Java at Oct 29 2004, 01:50:30 AM MDT 22 Comments

Fun with Log4J and JBoss

I've had the pleasure of working with JBoss (3.2.5) and an AppFuse-based application for the past week. It was fairly easy to setup thanks to Rick Hightower's instructions. AppFuse uses commons logging (like many of its open-source dependencies), but uses log4j to control what gets printed to where. By default, it changes Hibernate and Spring to use WARN and the application classes to use DEBUG. For most containers, this works great. Drop in the WAR, or package it in an EAR and voila - your logging statements show up in the console. Not so with JBoss. Spring and Hibernate use INFO and I can't get any debug statements to show from my classes.

I shouda known this would be a pain since Rick wrote "Setting up logging is a pain in JBoss. Don't mess with the console log... it misbehaves. Create a file logger and tail it.". Is this the best practice for logging with Log4J in JBoss?

You'd think printing to the console would be easy. This wiki page even makes it look easy: change your log4j.properties to log4j.xml and add a <class-loading> snippet to your jboss-web.xml. Unfortunately, I get this nice error message:

00:21:17,593 WARN  [DeploymentInfo] Only the root deployment can set the loader repository, ingoring
 config=LoaderRepositoryConfig(repositoryName: log4j.config:loader=appfuse.war, repository
ClassName: org.jboss.mx.loading.HeirarchicalLoaderRepository3, configParserClassName: org.jboss.mx.l
oading.HeirarchicalLoaderRepository3ConfigParser, repositoryConfig: java2ParentDelegation=false)

Any ideas are appreciated - it seems wrong that I have to write to file just to tail it so I get the same console behavior I get with other servers.

Posted in Java at Oct 29 2004, 12:12:15 AM MDT 7 Comments

Using CruiseControl for Automating AppFuse Builds

After seeing Mike Clark speak at Denver's JUG earlier this month (download presentation), I became slightly motivated to try and get automated builds running for AppFuse with CruiseControl. It's fairly easy to do with Anthill, so I figured CruiseControl couldn't be too much harder.

After countless hours of trying to get it to work, I give up. I've documented what I did, and where I'm at - but I can no longer afford to spend any time on it. If you're motivated enough, feel free to try and get it working. Suggestions are welcome, but likely won't be acted upon since I'm burned out on CruiseControl.

Posted in Java at Oct 26 2004, 11:51:40 AM MDT 6 Comments

Rails - the MVC Framework for Ruby

When I first saw the quick setup for Rails video, I dismissed it as a something simple that wasn't that cool. Thanks to Dion's post, I decided to watch it again. Then I realized why it looked so simple the first time - the video kept looping and all I saw was the Apache setup part - I didn't see the whole video. After watching the video this morning, it's enough to make me want to become a Ruby developer and use Rails to develop my next webapp. Then again, Ruby probably doesn't pay the bills nearly as well. The upside is it looks like it would actually run fast on OS X instead of the dog-slow Ant/Tomcat/Eclipse/IDEA combination.

Hopefully I'll get to learn more about Rails at Denver's upcoming No Fluff Just Stuff. It looks like Dave has added it to his repertoire. I wonder if Rails has support for using the Copeland IoC container?

Posted in Java at Oct 25 2004, 03:19:00 PM MDT 9 Comments

Moving

Today is move-in day to our remodeled house. The final trim installation and a the last few doors should be done sometime this afternoon. It's hard to believe it's almost done. It's been a long journey since construction started in March. There were a few interesting times along the way, like the garage demolition and basement wall falling off. It's tough to mention it, but it wouldn't be right to talk about this finished house without taking a moment to remember Bob the Builder. He would be smiling from ear to ear if he was here today.

It's been 7 months since we moved into our current house. After living in sub-1000 sq. ft. houses for the last 15 months, it'll be nice to get some space again. Total square footage on new house? Somewhere around 2500 square feet! Here's a comparison between old and new (click to zoom in):

Old House
Old House
New House
New House

Posted in General at Oct 22 2004, 06:02:35 AM MDT 6 Comments

Comparing Web Frameworks: Equinox, Ant and Maven

Next week I'll be putting together the sample apps for my Comparing Web Frameworks talk. They're going to be pretty simple. They'll be created using Equinox and will closely resemble the MyUsers app created in Chapter 2 of Spring Live. That is, they'll just be simple webapps that allow you to CRUD a database table. MyUsers just edits a user's first and last name, but I'll probably add a "birthday" field to demonstrate Date handling. Even though it's simple, it'll have a pageable/sortable list, validation and success messages - which is what most apps need. Of course, if I can't get X feature to work, I'll make sure and highlight that in my talk.

Equinox is based on Ant and works quite well. However, I have a Maven version of Equinox that I developed for Open Logic this summer. They've been gracious enough to let me release this as open source. BTW, if you're looking for a rich set of Maven sample apps - Blue Glue 3.1 will have a few (including multi-project). Blue Glue also contains detailed documentation on each of these sample apps I'm creating for this talk.

So the question is - should I release a Mavenized version of Equinox? Or should I modify Equinox to contain and allow you to use both Ant and Maven? The problem with allowing both is I'd likely give up everyone's favorite Maven feature - downloading dependencies. I personally have grown to loath this feature b/c repositories are hardly ever up-to-date and I spend a lot more time trying to get repositories updated (or creating my own) than I would downloading the JAR. Spring uses both and simply points Maven to its local JARs. That's probably what I'd do.

Of course, the easiest (and KISS) thing to do is to use Equinox with Ant and not complicate things. However, I'm willing to put in a couple hours to try and make Equinox allow both. Regardless, I'm willing to release a Mavenized version of Equinox - if there's interest.

P.S. Don't forget to thank the Open Logic guys for making this all possible. I wouldn't have been able to do this talk without their generous donation.

Posted in Java at Oct 21 2004, 02:57:52 PM MDT 3 Comments

AppFuse's License

Someone sent me an e-mail today and made me aware that the Commons Attribute License that AppFuse uses only applies to documents and such:

"Collective Work" means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with a number of other contributions, constituting separate and independent works in themselves, are assembled into a collective whole.

Because of this, I'm thinking of switching to use an Apache 2 License. This seems to be the friendliest license for open source. Basically, all I want to do is try to get folks that use AppFuse to give it some credit. Which really means they're marketing it in a sense. More marketing -> more users -> (hopefully) I'll stay employed and the product will get better.

The only pain I can see about licensing with an Apache License is they want you to add a short copyright notice at the top. But I'm not really handing the copyright of AppFuse over to ASF, am I? Do I have to add this copyright to all my .java files? I know that Spring does this, but... ugh ... seems rather unnecessary.

Posted in Java at Oct 21 2004, 10:54:08 AM MDT 11 Comments

Automating the new house

Automating your project might be cool, but what about your home? In a recent Macworld issue, there's an article titled Automate Your Home. After reading it, I became inspired to do some automation in the new house. Since we're scheduled to move in this weekend, I'm getting close to buying the software and hardware necessary to do this. The top software packages seem to be Indigo (for OS X) and Active Home (for Windows).

I'm leaning towards the Windows version since my Windows box is always on and there's likely more information/experience working with that version. My PowerBook gets turned off frequently, so that's not a good idea. I could buy a new G5, but $4000 for home automation is a bit spendy. In reality, I'd like to find a easy-to-use (and install!) version for Linux since my Linux box is always on. Any tips?

I'd love to hear any experiences folks may have with automating their homes. Initially, I plan on automating light activation when you walk in the room. Any other cool ideas?

Posted in General at Oct 20 2004, 09:36:09 AM MDT 8 Comments

What's up with GMail?

I'm sure a lot of other GMail users have seen this. For the last couple of days, whenever I get an e-mail from someone with @gmail.com in their e-mail address, GMail displays the following warning:

Warning:  This message may not be from whom it claims to be. Beware of following any links in it or of providing the sender with any personal information. Learn more

My guess is they've had some sort of security breech or someone's been spoofing gmail addresses. Any ideas?

Posted in General at Oct 20 2004, 07:49:15 AM MDT 10 Comments