Spring Beginners Summarize ideas

Source: Internet
Author: User
Tags connection pooling

Spring Preliminary Study Summary

There are four aspects to the general summary: IOC,AOP,JDBC, and transaction management

IOC: Implements a reversal of the power of the new class. (The new class usually causes code redundancy, and the manual new class does not meet the requirements of the dynamic new class.)

AOP: Make it easy to add code (without having to add a source document, add it directly to the slice class, change the configuration document)

JdbcTemplate: Database operation is more simple

Transaction management: The methods of the same transaction are either executed successfully or not. (Save money to someone else affairs management to solve their own money is less than the money is not much of this situation occurs)

1.IOC (combination of annotations and XML (JUnit test))

Write a UserService this class

Test class:

XML configuration file:

2.AOP (Key AspectJ)

Write a class of Userdao

Slice class:

Test class:

XML configuration file:

3.jdbctemplate (annotations (configuring C3P0 connection pooling))

Write class User

Class Userdao:

Write a jdbc.properties database connection file:

To write a configuration file:

To write a test class:

4. Transaction management (annotations)

Writing the Accountdao class

Accountdaoimpl class:

Writing the Accountservice class

Accountserviceimpl class:

JDBC Database Connection File

XML configuration file:

Test class:

Spring Beginners Summarize ideas

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.