Spring Frequently Asked Interview

1, Java Exception
    unchecked abnormal (unckecked exception): Error and RuntimeException, and their subclasses.
    Abnormalities (checked exception): In addition to other abnormalities of RuntimeException and Error. Mandatory for such programmers to make preliminary exception processing
    runtimeException: abnormal, the processing system does not require to be run
        NullPointerException - null pointer reference exception
        ClassCastException - casts exception
        IllegalArgumentException - passing illegal argument exception.
        ArrayStoreException - stored to the array type is not compatible with the declared target abnormal
        IndexOutOfBoundsException - subscript bounds exception
        ArithmeticException - arithmetic abnormal
        NegativeArraySizeException - create a negative array size error exception
    IOException: exception must deal with non-runtime
        FileSystemException- file system operation fails Throws
        an exception is thrown when ChangedCharSetException- change the character set
        to throw an exception when CharacterCodingException- character encoding or decoding error occurred
        ClosedChannelException- thrown when trying to close the I / O operation invoked on the operating channel anomaly
        UnknownHostException- unable to determine the IP address of the host
2, Spring principle
    works Spring is to make not create a new object can be automated production, running when to dynamically create objects and call the object through the Spring configuration file.
3, during the execution of the brief SpringIOC
    loading profile ----- "IOC container according to create a corresponding profile ----" instantiated bean ------- "to load an instance of the bean good IOC container go ----- "calling bean.
4, the configuration in order bean.xml will affect the order of the objects to create it?
    Council ,,,, first with the first instantiation. If you create a beanA need another beanB, although this time beanB behind beanA nor affect beanA created.
5, if the configuration declarative transaction using XML, which several sub-steps
    1. Configure the transaction manager. DataSourceTransactionManager
    2. way communication services and configuration section
    Configuration tangent point
6, @ PathVariable and @RequestParam
    both accept requests from the request, may receive parameters
    @PathVariable: acquisition variable path from the URL, such as the URL: emp / {id} acquired ID
    @RequestParam: acquisition parameters, such as the URL: do pageSize = 3 to obtain pageSize = 3?
7, which is annotated with date format
    @DatetimeFormate ( "the MM-dd-YYYY")
. 8, the Spring interceptor
    implements inheritance class or classes inherit HandlerInterceptorAdapter HandlerInterceptor interface, disposed in the Springmvc.xml,
    HandlerInterceptor interface defines three method a:
    . 1) preHandle: prior to the call processing request, SpringMVC Interceptor is a chain of calls
    2) postHandle: returns the Interceptor preHandle method currently belongs can be called when the value true, DispatcherServlet return a view is called prior to rendering
    3) afterCompletion: this method also requires a current corresponding to the Interceptor preHandle method are performed when the return value is true, the method will be after the entire request, that is a corresponding view DispatcherServlet rendered after execution. The main role of this method is that the resources for clean-up work.
9, the difference between the interceptor and the Filter
    Spring interceptors and the Servlet Filter There are similarities, both reflect AOP programming ideas, can achieve permission checks. Logging the like, except that:
    Different 1. Scope: Filter is Servlet specification, use only the Web container, the interceptor for the Web application can also be used in other places
    different specifications 2, Filter in Servlet specification defined Servlet container is supported, the interceptor is in Spring container, Spring support frame.
    3. interceptor owned by management Spring, Spring resources which can be injected into the interceptor through the IOC.
10, SpringMVC several components
    1.DispatcherServlet request inlet
    2.HandlerMapping distribution request, the controller is responsible for requesting and establishing correspondence relations
    3.Controller processor
    4.ModelAndView package model information and view information
    5.ViewResolver view processor, positioning page
11, in addition to analytical jsp view resolver can resolve other views you
    can, InternalResourceViewResolver can find jsp, achieve org.springframework.web.servlet.view.freemarker in FreeMarkerViewResolver class can parse other views. You must configure freemarkerConfig
12, outlined the framework of the project SpringMVC build process
    to create the required import project ---- jar package configuration web.xml ---- ------ configuration mvc.xml, spring.xml-- - create class
13, if a service implements the interface, we need to use the controller, you should inject the interface or implementation class
    injection interfaces, spring is the default JDK dynamic proxy

14, Ajax's no refresh feature is the use of XMLHttpRequest asynchronous request to complete

Guess you like

Origin www.cnblogs.com/tk970803/p/11260365.html