What is the difference between callable and runable? Switch char? SQL only checks for existence, SQL copy table? Reflection? Spring MVC and Spring context differences?

Source: Internet
Author: User
Tags access properties

Department of Technology 2018.4.16

1. Callable and Thread differences

The line Cheng Nen that implements the callable interface returns the execution result, and runable is not. Callable's call method allows exceptions to be thrown.

Since callable can return execution results, if a thing can be divided into more than do, and then merge the results, you can use callable

Public interface Callable<v> {    V call () throws Exception;}
Public interface Runnable {public    abstract void run ();

2.

3. Select 1 from where con limit 0,1; Copy create table new table like
CREATE table new Table select * from old table (table structure and data will be copied)


What is reflection: the Java Reflection mechanism is a running state in which all the properties and methods of the class can be known for any one class, and the properties and methods of any one object can be called. This dynamic gets the information of the class and the method of invoking the object

Several ways
Object. GetClass (); Objects are there, and what do they reflect?
Classes. class; There is no third type of flexibility
Class.forName (full path name)


5. Spring MVC and Spring
Parent-child relationships. Spring MVC corresponds to a context that is a child context of spring and can access properties in the spring context.
Reference: https://www.cnblogs.com/huntdream/p/6012390.html
    

The so-called traditional type, is the action, service, DAO Three layer architecture, based on the complex business of large company development model.

For this mode, the general spring context is controlled on the service, DAO two layer, and the thing integrity is also controlled at the service layer, while the Springmvc-servlet controls the action layer.

This result results in the following call relationships:

    • Action can invoke service, DAO;
    • Service, DAO cannot invoke action;
    • The AOP of the spring context container cannot be applied to the action layer, but it can be done by defining it in Springmvc-servlet.xml.
         //spring的上下文
         WebApplicationContext ac1 = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());          //springMVC的上下文          WebApplicationContext ac2 = RequestContextUtils.getWebApplicationContext(request);



What is the difference between callable and runable? Switch char? SQL only checks for existence, SQL copy table? Reflection? Spring MVC and Spring context differences?

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.