ssm framework of a simple summary notes

A .mybatis

Configure-to-many and many-to-1 query query annotations mapped relationship:
array declaration mappings configured to receive @Result the Value property: @Results
@Result: mapping an
id attribute (boolean) a statement whether the primary key Configuration
Property Properties properties subjects in
the field name Column property of the query

二.spring

2 Create the current object to the annotation spring container-managed
@Component (value = "id identification")
@Controller (value = "identify the above mentioned id") web layer
@Service (value = "id identification") service layer
@Repository (value = "id identification") dao layer
Description: class needs to be configured to specify a unique identifier attribute Value

3 dependency injection property annotations
@Autowired
Description: Default by type (interface) to find the object from the container and can be injection property name as a unique identifier to find the object from the container and injected
@Qualifier (value = "id identification") Value Properties may be injected in accordance with id uniquely identifies
@Value
Description: injecting data base data type may also be injected into the contents of the properties file managed in the spring containers

4 Notes related to the life cycle of
@Scope
Description: The Role of Value properties of the object (Singleton | prototype)
@PostConstruct
Description: to set the configuration method to initialize method
@PreDestory
Description: to set the configuration method to destroy method

5 using the configuration class Alternatively xml configuration file annotation
@Configuration: configuration class declaration
@ComponentScan: Open Pack scan
@PropertySource: the spring properties to the container profile management
@Import: introduce other configuration class
@Bean: a method configured to, this indicates that the return value to the spring container management

Related annotations 6 springTest of
@Runwith (SpringJunit4ClassRunner.class) class declaration spring loading profile provided
@ContextConfiguration declaration spring configuration information
Locations attribute xml configuration file attributes Classes configuration class bytecode

7 AOP annotations associated
@Aspect class declaration section
@PonitCut arranged to define a common entry point for the method of the empty
value attribute pointcut expression references: Method name ()
configure the types of notifications:
@Before pre-notification
@AfterReturnint post notification
@AfterThrowing exception notification
@After final notification
@Around around advice
@EnableAspectJAutoProxy open support for AOP annotations for use pure notes

8 transaction-related annotations
using the configuration transactions on a class or method @Transactional need transactions
@EnableTransactionManagement pure annotated with representatives of open support for annotation affairs

Three .springmvc

9 @RequestMapping Mapping ( "/ user") to make access path and the current browsing method
@RequestHeader acquired information request header
@CookieValue acquired the cookie JSESSIONID
@RequestBody arranged on a method parameter which indicates the character string into json java Object
@ResponseBody configured into the method returns a value indicating that the object into a string json
@RequestBody method of configuration parameters to indicate the target string into json
@SessionAttributes (value = { "username" }) // represents the current class All object manipulation methods as long as the model parameters are specified to maintain a session scope
@ModelAttribute ( "aaa") add elements to the Model

10 restFul code programming requirements:

Determining the address parameters (id) How to set the path format: {id}
to determine how to obtain the address parameters (id) used in the method of annotation parameters: @PathVariable (value = "id" )
to specify a certain way to submit effective @RequestMapping (value = "/{idddd}.html",method = RequestMethod.GET) to get only submit valid

Published 17 original articles · won praise 0 · Views 863

Guess you like

Origin blog.csdn.net/qq_36833168/article/details/103952785