Some classic questions about spring
1. What are the principles for the IOC and AOP of spring?
The main application of the Java Reflection Technology
2.spring working mechanism and why use?
1) Spring MVC requests that all requests be submitted to Dispatcherservlet, which will delegate the other modules of the application system responsible for the actual processing of the request.
2) Dispatcherservlet queries one or more handlermapping to find the controller that handles the request.
3) Dispatcherservlet request submit to target Controller
4) After the controller has processed the business logic, it returns a Modelandview
5) Dispathcher Query one or more viewresolver view resolvers to find the view object specified by the Modelandview object
6) The View object is responsible for rendering back to the client
Why use:
AOP allows developers to create non-behavioral concerns, called crosscutting concerns, and insert them into application code. With AOP, public services (such as logs, persistence, transactions, and so on) can be decomposed into facets and applied to domain objects without increasing the complexity of the object model of the domain object.
IOC allows you to create an application environment where objects can be constructed, and then pass their collaboration objects to those objects. As the word inversion shows, the IOC is like the reverse JNDI. Not using a bunch of abstract factories, service locators, single elements (singleton), and direct constructs (straight construction), each object is constructed with its collaboration objects. Therefore, the collaboration object (collaborator) is managed by the container.
Spring even an AOP framework, is also an IOC container. The best part of Spring is that it helps you replace objects. With Spring, you simply add dependencies (collaboration objects) with the JavaBean property and configuration file. You can then easily replace collaboration objects with similar interfaces when you need them.
3. How to achieve internationalization?
Internationalization: No need to modify the code, it is applicable to different language countries
Localization: If you want to adapt to a country, to modify the source code
Implementation process:
In Struts-configxml using the following tags to explain the resource file name, note that it is only the file name, no language _ country
Include the properties file for different languages and countries in the directory struts that corresponds to the resource file
Applicationresources_zh_properties China
Applicationresources_en_usproperties US
If not English to transcode
native2ascii-encoding gb2312 Source Applicationresources_zh_cproperties
In a JSP page
Take out information
What is the difference between beanfactory and ApplicationContext in 4.Spring?
ApplicationContext and Beanfacotry provide more extension functionality, but the main difference is that the latter is lazy loading, and if a bean attribute is not injected, the beanfacotry is loaded, The exception is thrown until the first use of the call Getbean method, while the ApplicationContext initializes itself as a test, which facilitates checking whether the dependent property is injected, so we typically choose to use ApplicationContext.
5. Tell me about your understanding of developing with the SSH framework?
Frame: Hibernate, spring, struts;
Hibernate is mainly used for data persistence;
Spring's inversion of control can play a role in decoupling;
Struts are primarily used for process control.
6. Please explain what MVC is? (design mode)
A) M----Model Package business data and business operations.
B) V-----View Package user interface.
c) C-----Controller encapsulates the business process flow.
7. What are the technologies that are implemented in every part of MVC?
Presentation Layer Struts
Persistent layer Hibernate
Control Layer Spring
Which is the most common development framework SSH
8. Through the diagram, talk about your understanding of the MVC model. (Is it possible for companies to draw students)?
1) The first is the display view to the user, the user in this view to operate, and fill in some business data
2) Then the user clicks the Submit button to make a request
3) The user request from the view reaches the controller, which contains the business functions and related data to be completed in the request.
4) The controller handles the user request, encapsulates the data in the request, selects and invokes the appropriate model, requests the model for status updates, and then selects the view to be presented to the user next.
5) The model will handle the business functions requested by the user, while maintaining and updating the model State.
6) When the model state changes, the model notifies the corresponding view that the view has changed in its state.
7) When the view borrows the notification of the model, it makes a status query to the model, obtains the data that needs to be presented, and then displays the data according to how the view itself is displayed.
8) The next step is to wait for the user to proceed again.
Some classic questions about spring