Java Stack

Programmatically add @Controllers to Spring MVC

Recently I had a requirement to provide a controller as part of a reusable framework that was included in multiple projects. Typically, creating a controller is as simple tagging a class with @Controller and making sure it’s in a package that is scanned, thanks to the annotation scanning introduced in Spring MVC 2.5, however in this case we couldn’t rely solely… Read more →

Spring MVC w/ no XML

Just a quick update: finally figured out how to setup Spring MVC without any XML during my lunch break.. Yeah, I’m a nerd like that. Spring for lunch. Anywho, on to setup Spring MVC without XML (as in no applicationContext.xml file). There’s two approaches you can take: Configure a global ApplicationContext via the ContextLoaderListener that bootstraps Spring in the J2EE web.xml file (thus… Read more →

Maven Archetypes

Spent a few minutes reading some official Maven docs regarding Archetype generation & followed a simple create-from-project tutorial using a toy project I’m working on as a skeleton. The pieces of it finally sunk into place! Essentially, it boils down to two steps: mvn archetype:create-from-project, followed by abstracting the generated archetype from target/generated-sources/archetype. After that, just polish and release! I’ve looked into archetype creation… Read more →