Annotations commonly used in spring
From a mapping, a dao layer, a service layer controller controller
From the bean's point of view
@Component component, no explicit role
@Service is used in the business logic layer (service layer)
@Repository is used in the data access layer (dao layer)
@Controller is used in the presentation layer, the declaration of the controller (C
@Autowired: Provided by Spring
@Configuration declares that the current class is a configuration class, which is equivalent to Spring configuration in xml form (on the class)
① Difficult to solve errors encountered in a project!
Array out of bounds -- "length is not enough
②What is the database problem grouping function?
①, group by and having are used together and grouped together, but where has nothing to do with grouping
②, where and having having are aggregate functions (count min max sum) cannot appear in where
What are the three paradigms of database
First Normal Form: Each column cannot be split again.
Second normal form: On the basis of the first normal form, non-primary key columns are completely dependent on the primary key, but cannot be part of the primary key.
The third normal form: On the basis of the second normal form, non-primary key columns only depend on the primary key and do not depend on other non-primary keys.
1、整数类型
,包括TINYINT、SMALLINT、MEDIUMINT、INT、BIGINT
2、实数类型
, including FLOAT, DOUBLE, DECIMAL.
3、字符串类型
, including VARCHAR, CHAR, TEXT, BLOB
4、枚举类型(ENUM)
, to store unique data as a predefined collection.
5、日期和时间类型
, try to use timestamp, the space efficiency is higher than datetime,
The difference between MySQL storage engine MyISAM and InnoDB
Storage engine Storage engine: How data, indexes, and other objects in MySQL are stored, it is an implementation of a file system.
The commonly used storage engines are as follows:
Innodb engine: Innodb engine provides support for database ACID transactions. And also provides row-level locks and foreign key constraints. Its design goal is to handle database systems with large data volumes.
MyIASM engine (originally Mysql's default engine): does not provide transaction support, nor does it support row-level locks and foreign keys.
MEMORY engine: All data is in memory, and the data processing speed is fast, but the security is not high.
4 major features of the InnoDB engine
-
insert buffer
-
Second write (double write)
-
Adaptive Hash Index (ahi)
-
Read ahead
The principle of spring cloud
Let me talk about the underlying principles of the Spring Cloud microservice architecture
In fact, Spring Cloud is a family-bucket technology stack that includes many components. This article starts with its core components to analyze its underlying working principle. That is, the components of Eureka, Ribbon, Feign, Hystrix, and Zuul.
③Deduplication of database?
(1), rowid method-"According to the rowid attribute of oracle, it can be judged whether there are repeated statements
(2), group by method - "grouping is used in aggregate functions
(3), distinct method - "used to deduplicate smaller tables, will filter out duplicate records, and return non-duplicate records or fields
④ Connect left and right!
JOIN: returns rows if there is at least one match in the table
LEFT JOIN: returns all rows from the left table even if there is no match in the right table
RIGHT JOIN: returns all rows from the right table even if there is no match in the left table
FULL JOIN: returns rows as long as a match exists in one of the tables
⑤java access modifier!
The current class is the same as the descendant class of the package class Other classes
The current public public class is the same as the descendant class of the package class Other classes
protected The protected current class is the same as the descendant class of the package class
friendly has good current class and package class
private private current
⑥ The difference between hashmap and hashtable!
Common: Both are implementation subclasses of map
Hashmap threads are not safe, and deadlock may occur in a concurrent thread environment
Hashtable thread is safe and its methods are all added with Synchronize
⑦Iterator traversal!
Two methods: for and while
.next和.hasNext
⑧ polymorphic understanding? Overload rewrite!
Polymorphism:
- The virtual function must be called through the pointer or reference of the base class (the modified class member function is called a virtual function)
- The called function must be a virtual function, and the derived class must rewrite the virtual function of the base class (the return value parameter is the same as the list)
Overloading: same name but different parameters have no return value
Rewrite: Same name, same parameter, return value
⑨Singleton mode, hungry man mode and lazy man mode
Singleton pattern: there can only be one instance
Hungry man mode: thread safety issues are only given when it is used. Instantiating a static object will take up a certain amount of memory and call it for a certain period of time. The speed is also fast
Lazy man mode: just give it when you are full, thread is not safe
⑩spring (aop and ioc)
The difference between ioc and aop
ioc: Inversion of control dependency injection is transferred from the original programmer to spring management
aop: aspect-oriented Throw out non-core code and use it on logs or things
MVC three-tier architecture
M : Model, model. JavaBean
- Complete specific business operations, such as querying the database and encapsulating objects
V : view view. JSP, HTML, etc. for data display
C : Controller controller. Servlets
The three-tier architecture is divided into: presentation layer (UI) (web layer) , business logic layer (BLL) (service layer) , data access layer (DAL) (dao layer), plus entity class library (Model)
If you need more interview questions, you can private message me! !