Spring in Action (3)

Source: Internet
Author: User

First figure out a few concepts:

1. What is Pojo

2. JavaBean specification

3. EJB (Enterprise JavaBean)

  Experience how spring simplifies Java development.

  The behavior of creating collaborative relationships between application objects (components) is often called assembly, which is also the essence of dependency injection.

Dependency injection keeps loosely coupled software components that work together, while AOP programming allows you to separate functionality across applications to form reusable components.

Aspect-oriented programming is often defined as a technique that drives applications to isolate concerns.

The real value of dependency injection is to assemble the objects that are co-working with each other without the need for these objects to assemble themselves.

1, one of the ways of dependency injection is constructor injection. (so-called dependency injection is the passing of a class in the form of a parameter to another class)

Injecting an object reference through the constructor
Publicclass a{ private b b; Public A (b b) { this. b=b; // b is injected in . If B is an interface, it will be more flexible }
}

2. Attribute injection (Pojo Class)

 Public classa{Private intNo; Privateb b;  Public intGetno () {returnNo; }     Public voidSetno (intNO) {No= no;//inject simple value No    }     PublicB Getb () {returnb; }     Public voidSetb (b b) { This. B = b;//Inject B    }}

Spring advocates interface-oriented programming, and interface-oriented programming and dependency injection collaboration enable loose coupling.

In software development, the functions distributed in many applications are called crosscutting concerns . Typically, these crosscutting concerns are conceptually related to the applied

The business logic is separated (but often embedded directly into the business logic of the application). Separating these crosscutting concerns from the business logic is

To be addressed in aspect-oriented programming (AOP). crosscutting concerns can be modularized into special classes, which are called facets.

Inheritance and delegation are the most common object-oriented techniques for implementing the common functionality of reuse. Facets provide an alternative alternative to inheritance and delegation.

Creating a pointcut to define the connection points that the facets weave into is the basic functionality of the AOP framework. Because spring is based on dynamic proxies, spring only supports method connection points.

One of the goals of spring is to allow developers to follow the " Programming for Interfaces " in object-oriented (OO) principles when developing applications.

Spring security addresses security issues from two perspectives. It uses a servlet filter to secure Web requests and restrict URL-level access.

You can also use the Spring AOP protection method invocation--with the help of object proxies and usage notifications, to ensure that only users with the appropriate permissions can

Methods for accessing security.

Spring in Action (3)

Related Article

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.