Home > spring-recipes

spring-recipes

Spring-recipes is a project mainly written in Java, it's free.

Source code examples and my tests from Spring Recipes, Second Edition - Apress, covering Spring 3.0

To run the examples:

$ mvn compile

Load a basic bean, with property injection
$ mvn -q exec:java -Dexec.mainClass='com.apress.springrecipes.sequence.Main' -Dexec.args='Main.xml'

The same thing, with the p-schema shortcut $ mvn -q exec:java -Dexec.mainClass='com.apress.springrecipes.sequence.Main' -Dexec.args='MainWithPSchema.xml'

List injection $ mvn -q exec:java -Dexec.mainClass='com.apress.springrecipes.sequence.Main' -Dexec.args='ListInjection.xml'

Map injection $ mvn -q exec:java -Dexec.mainClass='com.apress.springrecipes.sequence.Main' -Dexec.args='MapInjection.xml'

Spring MVC

Should work with Tomcat 5.5+, in Eclipse choose Run As > Run on Server, URL may change, typically on a local installation:

Simplest Servlet http://localhost:8080/spring-recipes/welcome

Example of Search, Try with "Tennis #1", "Tennis #2" http://localhost:8080/spring-recipes/reservationQuery

Mapping /member/* to different class methods: http://localhost:8080/spring-recipes/member/add http://localhost:8080/spring-recipes/member/remove http://localhost:8080/spring-recipes/member/delete http://localhost:8080/spring-recipes/member/jdoe

Spring REST

Example of using a REST Service with RestTemplate http://localhost:8080/spring-recipes/sportsnews