Framework Technical Interview Questions

1. The operation process and principle of SpringMVC

Insert picture description here

    1. The user sends a request to the front controller (DipatcherServlet)
    1. The front controller sends the request url to the handler mapper (HandlerMapper), and the handler mapper finds the handler according to the url.
    1. The processor mapper returns the handler to the front controller.
    1. The front controller requests the processing adapter to execute the handler
    1. After executing the handler, return to ModelAndView to handle the adapter
    1. The front controller requests the view resolver to resolve it, and resolves it into a real view based on the logical view name.
    1. The view resolver returns the view to the front controller.
    1. View rendering, fill the view model data into the request field
    1. The front controller responds to the result to the user

2. Spring common annotations

  • Declare bean annotation
    @Compoent: component, no clear role
    @service: used in the business logic layer (service layer)
    @Repository: used in the data access layer (dao layer)
    @Controller: used in the presentation layer, controller declaration ( Controller)
  • The annotation
    @Autowired injected into the bean : The default assembly is by type. If we want to use assembly by name, we can use it in conjunction with the @Qualifier annotation.
    @Resource: assemble by name by default, and assemble by type when no bean matching the name is found.
  • Java configuration class related solution
    @Configuration: Declare the current class as a configuration class, which is equivalent to the Spring configuration in xml form (on the class)
    @Bean annotation on the method, declare that the return value of the current method is a bean, instead of the way in xml (method on)

3. SpringBoot common annotations

@SpringBootApplication: When creating a project, the annotation created by default in the entry class. It is a combined annotation, which contains multiple annotations. Among the more important notes are:

  • @SpringBootConfiguration
  • @EnableAutoConfiguration
  • @ComponentScan

4. The difference between get and load methods in hibernate

  • Load loading method
    When using the load method to get an object, hibernate will use the lazy loading mechanism to load the object.
    When an object is loaded using the session.load() method, no SQL statement will be issued. The object is actually It is a proxy object, and this proxy object only saves the id value of the entity object. Only when we use this object and get other properties, will SQL statements be issued at this time to query the relative object from the database

  • get loaded manner
    with respect to the delayed loading of the load, get more directly, when we use session.get () method to get an object, whether we do not make use of this object, sql statement will be issued at this time to go from the database Query it out:

Guess you like

Origin blog.csdn.net/yang13676084606/article/details/110531006