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.
You searched this site for "java". 1,588 entries found.

You can also try this same search on Google.

DJUG Book Reviews

The Denver JUG is certainly a thriving community. For those of you who can't visit us for a meeting - you can still get something from us. Five new book reviews have been added to the Denver JUG web site. Two reviews cover books about automated code generation: XDoclet in Action and Code Generation in Action. The other book reviews are for Core JSTL: Mastering the JSP Standard Tag Library, Pragmatic Unit Testing in Java with JUnit and Java Extreme Programming Cookbook, which covers JUnit and other development tools.

Unfortunately, I gave up my reading aspirations for coding. I hope to get back to reading after Spring Live has been published in June. In reality, however, I'll probably never find the time to read again unless I give up contributing to open source. 24 hours in a day sucks.

Posted in Java at Apr 19 2004, 03:19:33 PM MDT 1 Comment

New PowerBooks

Apple's New PowerBooks (announced today) don't impress me. Sure it's great that you can get a 1.5 GHz processor now, but I want more. I want at least a 2 GHz PowerBook. Why? The simplest reason is easily demonstrated by the following numbers - comparing my 2.6 GHz Windows XP Deskop to my 1.33 GHz PowerBook.

AppFuse TargetPowerBookDesktop
ant compile 44 seconds 25 seconds
ant test-all 6 minutes 7 seconds 3 minutes 18 seconds

Most Mac Heads will probably cry "compare the Dual G5 and see what happens!" I tried doing this at the MySQL conference last week, but the G5s didn't have internet access so I couldn't download Ant and AppFuse to test it out. Regardless, even if I was able to test it out - the G5 is a Desktop - and I want kick-ass speed in a laptop. You can certainly buy speedy Windows laptops.

This post is not meant to be a bash on PowerBooks - I love my PowerBook and I think that Apple makes the best damn laptop hardware out there. I just wish that Megahertz did matter to Apple and they'd give us a faster laptop. Then again, I'm pumped that these PowerBooks are not G5s, 'cause then I'd want one... ;-)

BTW, I tried Jikes 1.20 to speed things up and AppFuse won't even compile. The problem seems to be a bunch of ".class has an invalid format" errors from Cactus. Sorry Jikes, you failed the 10 minute test.

Posted in Java at Apr 19 2004, 09:28:59 AM MDT 10 Comments

i18n - synching up Struts and JSTL

As he did with Roller, Jaap van der Molen made some enhancements to AppFuse to fully support internationalization. He also translated all the existing keys to Dutch. What a guy, eh?!

After I installed this enhanced version of AppFuse, I noticed a few quirks. Namely that my default language was Dutch. To me, this meant that my browser's local must be Dutch. However, since it wasn't, I knew there had to be an issue. After a bit of Googling, I found my answer. It turns out that if you don't specify the language on your default properties file, JSTL won't pick it up - and it defaults to the first one with a language specified. This means that you must have ApplicationResources_en.properties instead of ApplicationResources.properties. Also, another quirk is that you need to synch up Struts locale-setting and JSTL's locale-setting. To do this, I added the following method to my ActionFilter.java class:

    // keep JSTL and Struts Locale's in synch
    Locale locale = (Locale) session.getAttribute(Globals.LOCALE_KEY);
    if (locale == null) {
        locale = request.getLocale();
    }
    if (request.getParameter("locale") != null) {
        locale = new Locale(request.getParameter("locale"));
    }
    session.setAttribute(Globals.LOCALE_KEY, locale);
    Config.set(session, Config.FMT_LOCALE, locale);

Even with all these "hacks" - Mozilla and Safari handle this stuff differently on the Mac. Jaap says that everything works fine on Windows w/o these hacks, so maybe it's just an OS X thing. Regardless, to make things easier, I've added the ability for users to switch between languages by clicking on their language of choice.

There's nothing like adding a new feature to something you're about to demo! I'm on in 45 minutes - the butterflies are fluttering like mad...

Posted in Java at Apr 15 2004, 12:42:00 PM MDT 9 Comments

MySQL Conference - Day 2

JBoss and MySQL
I'm sitting in Mark Fleury's session on MySQL and JBoss Integration. I'll try and record the things I learn in this session. The first thing that Mark mentions is how they own many popular open source projects: Hibernate, Tomcat, etc. - because they employ the lead developers on those projects.

JBoss Numbers
A standard in the market: #1 in development - more than 4 million downloads in last two years alone. A standard for System Integrators: #2 in growth - CRN survey puts JBoss certified consultant at #2 fastest growing certification with large system integrators. A standard in the market: #3 in production - JDJ survey: 70% of users to go Deployment. BZResearch survey. 13% in 2002, 27% in 2003, largest growth of all servers (IBM at 40% and BEA at 34%).

"Federated" Projects
JBoss AS, Hibernate, Tomcat, JBossIDE (Eclipse integration, XDoclet driven development, debugging), JBossCache (distributed data), JGroups (reliable multicast and cluster communication), Nukes (portal and CMS), JBossAOP and Javassist (bytecode manipulation library).

Cache and ORM: Scalability for MySQL
Keep your data in a MySQL instance. Put an ORM (Hibernate) layer on top of it. Replicate the data with cache infrastructure. Cache is King.

Mark is now talking about Hibernate and what it's useful for. I'm guessing that a lot of folks in this session are either interested in JBoss or Hibernate. He's talking about RDBs and what they do well. Next I'm guessing he'll talk about Hibernate and all its features. No need for me to regurgitate that information here - since I suspect a lot you are familiar with Hibernate. If not - what the hell are you waiting for? ;-) If you can't use Hibernate b/c you're standardized on SQL, you should at least use iBATIS. BTW - did you know that BEA's Page Flow demo app is a re-written version of Clinton's JPetstore? If you're standardized on JDBC, you might want to use Spring's JDBC support - which solves many of the problems with JDBC (try/catches, closing connections, etc.).

What is JBossCache?
A transactional replicated cache for JBoss with and without AOP. A cache for frequently accessed elements: Stateful Session Beans, HttpSession. Caches are used in a number of places in JBoss - this one provides a central cache service (MBean interface).

AOP Cache
Java is very dumb - Mark hopes the next OO language we use (in 10 years) is more event-driven (i.e. triggers in Java). This is possible today with AOP. In the example below, Joe's state is automatically transactional and replicated. State replicated, synchronized at transaction commit/rollback.

tree.start(); // kick start tree cache
tree.putObject("/aop/joe", joe); // add aop sanctioned object

tx.begin();
joe.setAge(41);
joe.getAddress().setZip(95124);
tx.commit();

Mark says, "HQL - soon to be EJB 3.0 QL". Interesting quote, eh?

PHP PostNuke - wasn't scalable when they first installed it because it hit the database all the time for security information. The Zend PHP didn't have the notion of global variables - so there wasn't a way to build a cache. According to the PHP guys, MySQL was the cache. JBoss re-wrote it all J2EE and now their server is at 5% utilization with an average of 500 concurrent users. Forums are a port of PHP BB - which is a very nice forum software package IMO. Personally, I'd prefer to use PHP BB over JBoss Nukes since most ISPs offer PHP out-of-the-box. I'm guessing that JBoss Nukes only runs on JBoss. Also, PHP BB is much cleaner and prettier out of the box. I'm a sucker for good looking webapps. ;-)

BTW, Jeremy Zawodny (Yahoo guy) has a number of links that might of interest for this conference. For your convenience, here's the best link: the 2004 MySQL Users Conference blog aggregator.

Posted in Java at Apr 15 2004, 08:30:58 AM MDT 7 Comments

MySQL Conference - Day 1

I'm sitting in the lobby of the MySQL Conference right now, next to Mr. Eden. He's been blogging this conference like a madman, so there's not reason for me to reproduce. See his posts if you're interested to see what's happening here: Registration and Opening Keynote, MySQL/Innodb Performance and J2EE Performance Tuning Workshop.

I attended the Keynote this morning, which was very informative. I didn't know that MySQL was being used so heavily in large enterprise environments. Moreover, there was an interesting slide that showed a performance comparison between MySQL (4.0.1 Max) and Oracle (9i), IBM DB2 (7.2), SQL Server (2000 SP2), Sybase (12.5). MySQL actually kept in step with Oracle in a 50 million row test - and beat the rest of the competition. Who says MySQL is only for small shops! ;-) I could give you the whole history of MySQL (I wrote it down), but I really don't the point. I'll add it here if I get enough requests. The big theme of the conference is definitely clustering.

After the keynote, I went upstairs and crashed. I was up until 3 a.m. last night fixing Ant support in Eclipse. Now you can run Ant (i.e. test-dao) or individual tests (i.e. LookupDAOTest) in Eclipse or IDEA. As part of this process, I removed the entity includes I was using for Spring's XML files. Now each file is loaded individually in tests and web.xml is configured to load them all. It seems a bit cleaner after making the change. Also, I tried to change to using "mappingJarLocations" for .hbm.xml file mappings. This would enable users to skip the step where they write the .hbm.xml file into applicationContext-hibernate.xml. Unfortunately, this works for everything but running Ant in Eclipse. WTF?! I guess the project's home directory is not the working directory in Eclipse. And finally - a warning: if you want to run JUnit tests in your IDE, you need to run "ant test-dao" (or another one) before running your test. It's not thoroughly tested since I run all my stuff from the command-line, but it's there. I definitely recommend using Ant in your IDE if you really want to use your IDE for everything.

The "Opening Night Reception" is about to begin - time to go get some free booze.

Update: I just got an e-mail on how to fix the Eclipse issue when using "mappingJarLocations". In Eclipse's Ant View right-click on a target, pull up the "Run Ant..." dialog. From there there you can set the "Base Directory:" to something like "${workspace_loc:/appname}". Tried that - doesn't work. :(

Posted in Java at Apr 14 2004, 03:48:37 PM MDT

Off to Orlando for MySQL Conference

I'm leaving in a few hours for the MySQL User Conference in Orlando. I'm looking forward to getting out of cold, snowy Denver. As I was getting ready to shut 'er down for the night, an interesting headline popped up in my Inbox.

PostgreSQL vs. MySQL vs. Commercial Databases: It's All About What You Need
Can you trust the leading open-source database engines, PostgreSQL and MySQL, to deliver the performance and features that the Oracles, SQL Servers, and DB2s of the world do? Not just yet, but they could offer enough to meet your needs. Find out how they stack up against each other, as well as against the commercial alternatives. [Full Article]

I don't have time to read it right now ... must ... get ... sleep ... but I thought it would be fitting to bookmark and read when I'm immersed in the land of MySQL lovers.

Posted in Java at Apr 13 2004, 12:40:29 AM MDT 1 Comment

[ANN] Display Tag 1.0 Beta 3 Released

View the Release Notes, checkout the changelog and/or download. Kudos to Fabrizio, who does almost all the work on this tag.

BTW, I tried downloading it a few times and it kept hanging (from several sites) - so I went with building from CVS. Same difference, right? And yes, all tests pass in AppFuse! ;-)

Posted in Java at Apr 12 2004, 02:51:02 PM MDT Add a Comment

My Review of Java Studio Creator (a.k.a. Rave)

I attended a Rave Demo at Sun in Broomfield today. The meeting actually had two parts - the first hour was a marketing schpeel about Sun's Enterprise Java System and the second hour was a demo of Java Studio Creator. The first hour was boring and very marketing esque - they did have an interesting price point though - $100 per employee. This is small business friendly, which is nice to see.

The Rave (a.k.a. Java Studio Creator) Demo was when things got good. Here's my notes from Dan Robert's presentation, followed by my impressions and comments. Dan is the Product Manager for JSC and was seemed to be very in tune with the tools marketing (i.e. all the good stuff from Intellij and Eclipse - and how JBuilder sucks).

What is it?

  • New Java Development Tools initiative
    • For the corporate developers who write code, but don't understand all of the complexity of J2EE and just need to get their job done.
  • A full fledged Java IDE
    • Visual Design Tools, 2-way editing, Editor, Debugger, Repository Management, and Project Management
    • Cool new Look and Feel
  • Complementary to NetBeans and Java Studio
    • Even Enterprise developers can use it for Rapid Prototyping
    • Use Java Studio or any other tool to add persistence layers (heh, this is b/c they think that persistence can only be EJBs ;-))

What does it do?

  • Quickly builds web applications that solve time-critical, real world problems
    • Complete web application creation for departments, workgroups and businesses of all sizes
    • Focus on easy to understand, event driven coding model
    • Simplifies access to existing infrastructure
    • All Java-standards based servers, all databases, all Web services, all desktops
    • Their main goal is to do web applications well, they'll catch up with the rest later

Standards-based solution for all developers

  • A development solution based on 100% Java standards
  • Delivers "Write Once, Run Anywhere"TM benefits: portable apps, portable developer skillsets
  • Quickly solves time-critical app development needs
    • Drag and Drop, rapid visual access to databasess and web services
    • consistent UI look/feel/behavior across all apps

Visual features to speed development

  • Palette for widgets, custom graphics, code clips, etc...
  • Query Editor

Simplified Access to Existing infrastructure

  • Use any JDBC Compliant Database (3.0)
    • Drag in and automatically create DB connections to data-aware components
  • Web Service Consumption
    • Easily pull in existing web services from Enterprise wide solutions or business partners

Java Studio Creator Roadmap

  • Hammerhead:
    • 2-tier dynamic content web applications based on JSP and JSF with Page Flow design tools
    • Releases: Early Access Spring 04 (today!), FCS Summer 04 (at JavaOne)
  • Thresher:
    • Minor Update Release
    • Focuses on Ease of Development and Stability
  • Mako
    • Extended Client Support

Download today from http://www.sun.com/jscreator. OS X version will be available shortly after the release (JavaOne).

After the PowerPoint, Dan started into the Demo. The first thing I saw that was cool was that when he clicked on the "Run" button, it actually deploys the app and opens the browser to run it. What you see in the browser looks very similar to what you see in the IDE. The IDE looks very simple. My current client went with me and he remarked that it "looks a lot like Eclipse."

The IDE has lots of palettes, and the UI essentially looks very clean. The pallets can be docked just like in IDEA - which I like. It looks a lot more like a native Windows application than it does like Swing. Here are the palettes it has:

  • Server Navigator
    • Data Sources
    • Web Services
    • Deployment Servers Palette
  • User Defined
    • JSF Standard Components
    • JSF Validators / Converters
  • Property Sheet
  • Project Navigator

Dan then dragged a drop down component and a table component onto the page. Secondly, he added a stylesheet and it visually changed the background and fonts on the page. I asked him if there was an imbedded browser. He said they took a look at using Mozilla, but it was too much and apparently one of the "real smart" engineers wrote the embedded browser component from scratch. Dan said it was the same guy who wrote the demo from scratch in 2 minutes at JavaOne last year. The thing I found very cool was that the HTML that is written into the JSP is XHTML - none of this Netscape 4.x support. Fuck Netscape 4.x - I'm glad Sun had the foresight to drop support for it.

After adding the stylesheet, Dan used the Data Sources navigator to grab a table and drag it to the drop-down. Then he did the same for another table and the data grid. Using the Visual SQL Query Builder (which looks a lot like M$ Access) he linked two tables and added a new column from a 2nd table to the grid. He then showed us that JSC has pretty good support for 2-way editing. Edit the code, the visual representation changes. Edit the visual, the code changes. This seems to be a big problem with WYSIWIG editors, especially when it comes to dynamic webapps. It appears that they've done a pretty good job to solve this.

Next he showed us some cool features of the components. For the table, there is an "enable paging" checkbox - and for the drop-down, you can right-click and select "auto-submit on change." He then set a couple of converter types on the drop-down and had to hand-code the event handler for the drop-down. Two lines of very simple code and he was done. The code was simple enough that you could have guessed the syntax. Code completion popped up nicely as well. Apparently the JSF coding style is that each page (JSP) is backed by a Bean that contains different event handlers. The code looked pretty simple and all the data was retrieved via RowSets.

Bill Dudney was there and asked about testing tools (i.e. Cactus or JUnit). Dan's response was that these are usually used by more advanced Java developers and there's talk of it, but nothing has been done yet. Now he pulls up a very cool page navigation creator which he uses to drag and drop buttons and links to point to different pages. Then someone asked about cost - and here's what makes it great. Under $300. They also hope to have lots of add on components for JSF by JavaOne. Unfortunately, there's no tooling for building JSF components in Java Studio Creator. For more information checkout http://developers.sun.com/jscreator.

The main reason I really like Java Studio Creator was that you literally never had to see any JSF code - and you get all of the features I like to use in webapps. Furthermore, I've been training a couple of guys all week on JSPs and using JSTL's SQL tags to do CRUD on a database table. While it's simple stuff, since they've never done web development before, it's a bit advanced. I'm sure their eyes will glaze over tomorrow when I start showing them how to write JUnit Tests, DAOs and how to use Hibernate to CRUD an object. They'll probably fall asleep by the time I show them how to wire the DAOs to Hibernate using Spring. When they saw this demo today - there eyes lit up and they got inspired to do their projects again. It looks easy for them now. All they need is a JDBC 3.0 driver for DB2 and they should be able to rapidly develop webapps with Java Studio Creator. I don't blame them for wanting to use this tool - it greatly simplifies things.

After the meeting, I asked Dan about transactions and if it was possible to use Hibernate instead of the RowSet stuff. He said that since JSC is based on NetBeans, you could probably write a plugin to use Hibernate instead of RowSets. As far as I know, the main reason you'd use Hibernate is for caching - but rowsets probably have that too. I know that the spec lead for JSF is talking to the Spring developers about JSF-Spring integration, so maybe that will be a future option as well.

Another thing that's not currently supported is the use of great technologies like Tiles or Sitemesh. Sitemesh integration would likely be pretty easy - you'd just never see your decorated UI in the IDE. Tiles is definitely something on the roadmap, but they don't have a solution yet. Dan indicated that using "includes" in your JSPs should work just fine - rendering in the IDE as they would in your browser. Good stuff - I hope we start using it at my current project - I think it'll do wonders for productivity. Since it's based on standards (JSF and RowSets) - the generated code looked pretty clean too.

Posted in Java at Apr 08 2004, 10:12:34 PM MDT 20 Comments

Make your JUnit Tests run faster when using Spring

JRoller is down, and has been down for an hour or so - so I've decided to post this Spring Live entry here.

I discovered an interesting thing today about Spring and my JUnit tests. I noticed that the VelocityEngine I was setting on my PositionManager was getting initialized once for each test* method in my Test. This means that since my PositionManagerTest has 10 test methods - it would load the context 10 times.

Loading the context so many times was because the following code was in my Test's parent's constructor:

    ctx = new ClassPathXmlApplicationContext("/applicationContext.xml");

I suppose I expected any constructor-iniatialized variables to be initialized once and only once. So I figured out a solution to make my JUnit tests run faster. By making the ctx variable static, and loading the file in the member variables definition, I greatly reduced the amount of time needed to run tests. Below is the new code I'm using:

    protected static ApplicationContext ctx = 
    	new ClassPathXmlApplicationContext("/applicationContext.xml");

By doing this, the ApplicationContext is only set once, and my tests run much faster. Here's some performance comparisons from Struts Resume:

Average time to run "ant test-dao": 36 seconds
Average time to run "ant test-dao" after this change: 26 seconds

A 10 second improvement - that's crazy talk dontcha think?! I've tried it on single tests, as well as suites - and it seems to improve performance by approximately 30% across the board.

Because of this experience, I have to recommend that when you write JUnit tests that use Spring - you should initialize your ApplicationContext in a static member variable. It seems to be the best performing and logical choice. Of course, if I'm off my rocker - please let me know.

On a sidenote, it would be cool if Roller allowed me to turn off comments for a single post. I like how Simon posts stuff on java.net and then aggregates it to his personal weblog.

Posted in Java at Apr 08 2004, 01:22:14 AM MDT 21 Comments

Eclipse Plugins updated for 3.0 M8

At my current client, I'm teaching a class this week on developing Java-based webapps. I'm starting simple with basic JSPs and JSTL's SQL Tags. Later, I plan to teach them how to write JUnit tests, DAOs, Actions, etc. I hope to show them how Hibernate and Spring can reduce the pain of J2EE.

The main problem is that it's kinda tough to teach this stuff to people that have no webapp development experience. How can you tell them Hibernate is soooo much easier, when they've never used JDBC? How can you show them that Spring simplifies things when they've never developed a complicated app?

Anywho, back to the point of this post. As part of the first day, I had the class (actually, there's only 2 students) setup their development environments (JDK, Eclipse and Tomcat). I decided to go with the latest Eclipse 3.0 M8 b/c I'm an upgrade junkie and I firmly believe that it's best to teach the latest and greatest stuff. Because we're using M8, I had to update a bunch of plugins and decided to package it up and release it. So without further ado, I give you Eclipse Plugins 1.1. [Download, Release Notes]

Here's the current list of plugins included in this package:

NOTE: I updated most of these plugins because older ones didn't work with Eclipse 3.0 M8. I haven't tested all of these, but they are the latest versions (as of yesterday).

I still use Eclipse on Windows, but I sure am getting used to using IDEA on the Mac. Now if I could only figure out some slick ways to pre-program keys-to-code. The Flex guy in NYC last weekend would press one key and a whole block of text would appear. I think that'd be a nice touch for next week's presos in Florida. It'd be cool to write a JUnit Test, DAO Interface, and DAO Implementation in a matter or keystrokes (i.e. one for each method).

Related posts: 1.0 Release.

Posted in Java at Apr 08 2004, 12:37:23 AM MDT 17 Comments