Spring

annotations

 * @Controller = controller
 * @RequestMapping("/") = the url to map
 * @SessionAttributes("modelview") = the session value to look up
 * @ModelAttribute("modelview") Object obj = the session or request attribute to look up
 * @PathVariable("groupId") int groupId = convert the request mapping {value} to a variable
 * @RequestParam("param") String param = convert the query string "?name=value"
 * @RequestBody Object obj = convert marshalled object from request content, normally used with xml content
 * @ResponseBody = the return value is the response body rather than using the spring ModelAndView.


 * http://static.springsource.org/spring/docs/2.5.x/api/index.html?org/springframework/web/bind/annotation/RequestParam.html

examples
This is a controller which handles base URL /myApp/group and looks for session attributes named "modelview"

context:component-scan

 * multi-packages

it looks for:
 * @Controller
 * @Repository
 * @Service
 * @Component

NamedParameterJdbcTemplate
String insert &#61; "INSERT INTO " + POJO.class + " ( `name` ) VALUES ( :name ) "; this.simpleJdbcTemplate.update( insert, new MapSqlParameterSource.addValue("name", name) );

See

 * http://static.springsource.org/spring/docs/2.5.x/reference/jdbc.html

Resource servlet
For loading static resources, even from within /WEB-INF/

Context management and caching
package com.example;

@RunWith(SpringJUnit4ClassRunner.class) // ApplicationContext will be loaded from "classpath:/com/example/MyTest-context.xml" @ContextConfiguration public class MyTest { // class body... }

@RunWith(SpringJUnit4ClassRunner.class) // ApplicationContext will be loaded from "/applicationContext.xml" and "/applicationContext-test.xml" // in the root of the classpath @ContextConfiguration(locations&#61;{"/applicationContext.xml", "/applicationContext-test.xml"}) public class MyTest { // class body... }

@RunWith(SpringJUnit4ClassRunner.class) // ApplicationContext will be loaded from "/base-context.xml" in the root of the classpath @ContextConfiguration(locations&#61;{"/base-context.xml"}) public class BaseTest { // class body... }

// ApplicationContext will be loaded from "/base-context.xml" and "/extended-context.xml" // in the root of the classpath @ContextConfiguration(locations&#61;{"/extended-context.xml"}) public class ExtendedTest extends BaseTest { // class body... }

See

 * http://static.springsource.org/spring/docs/2.5.1/reference/testing.html#testcontext-ctx-management

Security

 * See Spring security

Bean defintions
How to statically define the bean objects for Maps, and List.

Spring Qualifier and property placeholder
Spring Qualifier and property placeholder