JAVAEE exercises

  1. Basic application of Spring

exercise

  • fill in the blank
  1. The role of dependency injection is to dynamically inject the objects it depends on into the [Bean] component when creating objects using the Spring framework.
  2. After using the Spring framework, the instance of the object is no longer created by the caller, but by the [Spring container], and the Spring container will be responsible for controlling the relationship between programs, rather than being directly controlled by the caller's program code.
  3. In the Spring starter program, you only need to copy the 4 basic packages of Spring and the JAR package of [   commons-logging    ] to the lib directory, and publish them to the class path.
  4. To put it simply, BeanFactory is a factory that manages beans. It is mainly responsible for initializing various beans and calling their [life cycle] methods.
  5. The JAR package required for Spring development is divided into two parts: [  Spring Framework Package    ] and [   Third-Party Dependency Package    ].
  • True or False
  1. The constructor-based dependency injection in Spring is implemented by calling the constructor with parameters, and each parameter represents a dependency. (0) 1
  2. Usually in a Java project, the ApplicationContext container is instantiated through the FileSystemXmlApplicationContext class. (0)
  3. When beginners learn the Spring framework, they only need to copy the four basic packages of Spring and commons-logging.jar to the lib directory of the project and publish them to the classpath. ( 1 )
  4. The role of dependency injection is to dynamically inject the objects it depends on into the Bean component when creating objects using the Spring framework. ( 1 )
  5. The Spring framework adopts a layered architecture, and its series of functional elements are divided into 20 modules. ( 1 )
  • multiple choice
  1. The following statements about the Spring core container are wrong. (A)

A: All functions of the Spring framework are implemented through its core container. main

B: When creating a BeanFactory instance, you need to provide detailed configuration information of the container managed by Spring, which is usually managed in the form of an XML file.

C: ApplicationContext not only includes all the functions of BeanFactory, but also adds support for internationalization, resource access, event propagation, etc.

D: Usually in a Java project, the ApplicationContext container will be instantiated through the ClassPathXmlApplicationContext class, while in a Web project, the instantiation of the ApplicationContext container will be done by the Web server.

  1. The following statements about the four basic packages of Spring are correct. (D)

A: The four basic packages of Spring correspond to the four modules of the Spring Web container.

B: The four basic packages of Spring are spring-core.RELEASE.jar, spring-beans-.RELEASE.jar, spring-context-.RELEASE.jar and spring-aop-.RELEASE.jar . expression

C: spring-context-.RELEASE.jar is a JAR package used by all applications, which contains all classes related to accessing configuration files and performing IoC or DI operations. beans

D: spring-core.RELEASE.jar contains the basic core tool classes of the Spring framework. Other Spring components must use the classes in this package, which is the basic core of other components.

  1. Which of the following statements about the advantages of the Spring Framework is true. (B)

A: Spring具有简单、可测试和松耦合等特点,从这个角度出发,Spring就是应用于任何Java应用的开发中;也可用于服务端开发

B: Spring提供了对AOP的支持,它允许将一些通用任务,如安全、事务、日志等进行集中式处理,从而提高了程序的复用性

C: Spring就是一个大工厂,可以将所有对象的创建和依赖关系的维护工作都交给Spring容器管理,杜绝了组件之间的耦合性

D: Spring增加了Java EE开发中一些API的使用难度

  1. Spring的核心容器是其他模块建立的基础,以下哪个不是该容器的组成模块。( D )

A: Beans模块

B: Core模块

C: Context模块

D: AOP模块Expression

  1. 下列选项中,不属于Spring框架优点的是。( A )

A: 提供强大的、可以有效减少页面代码的标签

B: 声明式事务的支持。

C: 方便解耦、简化开发

D: 方便集成各种优秀框架

  • 简答题
  1. Spring依赖注入通常有哪些实现方式,列举并分别进行说明。
  1. Spring中的Bean

习题

  • 填空题
  1. 所谓自动装配,就是将一个Bean自动的注入到到其他Bean的【   Property   】中。
  2. @Controller通常作用在控制层,如Spring MVC的【  Controller    】,用于将控制层的类标识为Spring中的Bean,其功能与@Component 相同。
  3. 【   @Repository    】The annotation is used to identify the class of the data access layer (DAO layer) as a bean in Spring, and its function is the same as that of @Component.
  4. For beans in the [prototype] scope, Spring is only responsible for creating them. When the container creates a Bean instance, the Bean instance is handed over to the client code for management, and the Spring container will no longer track its life cycle.
  5. The instance factory method adopts the method of directly creating Bean instances. In the configuration file, the Bean that needs to be instantiated points to the configured instance factory through the [factory-bean] attribute, and then uses the factory-method attribute to determine which method in the factory to use.
  • True or False
  1. The @Component annotation is used to describe the Bean in Spring. It is a generalized concept that only represents a component and can be used at any level. When using it, you only need to mark the annotation on the corresponding method . (1) 0
  2. Spring provides three XML-based assembly methods: set value injection, construction injection and attribute injection . (0)
  3. Each time a client requests a singleton-scoped bean, the Spring container creates a new instance, regardless of the life cycle of those configured as singleton-scoped beans. (0)
  4. A bean defined using prototype in Spring will have only one instance in the Spring container, that is, no matter how many beans refer to it, it will always point to the same object. (0)
  5. For prototype-scoped beans, Spring is only responsible for creating them. When the container creates a Bean instance, the Bean instance is handed over to the client code for management, and the Spring container will no longer track its life cycle. ( 1 )
  • multiple choice
  1. The value of the autowire attribute in the Spring element does not include the following. (D)

A: default    B: byName    C: byType    D: byId

  1. Which of the following statements about the Bean assembly method is correct. ( D ) C

A: The Spring container supports various forms of Bean assembly, such as XML-based assembly, annotation-based assembly and automatic assembly (the most commonly used is XML-based assembly);   annotation

B: Spring provides three XML-based assembly methods: set value injection, construction injection and attribute injection

C: In the process of Spring instantiating Bean, Spring will first call the default constructor of Bean to instantiate the Bean object, and then call the setter method through reflection to inject property values;  

D: Set value injection requires that a Bean must provide a parameterized construction method and provide a corresponding setter method for the property that needs to be injected.

  1. Which of the following does not belong to the scope of beans in Spring 4.3 version. (C)

A: application    B: request    C: response    D: globalSession

  1. A series of annotations are defined in Spring, and the following annotations about its commonly used instructions are wrong. (A)

A: @Autowired is used to mark the Bean's attribute variables, attribute setter methods, and construction methods, and cooperate with the corresponding annotation processor to complete the automatic configuration of the Bean. By default, it is assembled according to the name of the Bean   . type

B: @Repository is used to identify the class of the data access layer (DAO layer) as a bean in Spring.

C: @Service usually acts on the business layer (Service layer), and is used to identify the class of the business layer as a bean in Spring.

D: @Controller usually acts on the control layer (such as the Controller of Spring MVC), and is used to identify the class of the control layer as a bean in Spring.

  1. Among the following options, those that do not belong to the way of instantiating beans in Spring are. (D)

A: Constructor instantiation B: Static factory instantiation 

C: Instance factory method instantiation D: Abstract method instantiation

  • short answer questions
  1. Please briefly describe the requirements for set value injection in XML-based assembly.
  1. Spring AOP

exercise

  • fill in the blank
  1. The annotation [@Pointcut] in the AspectJ framework is used to define the pointcut expression. When using it, it is also necessary to define a method signature containing a name and any parameters to represent the pointcut name.
  2. In the Spring configuration file, the pointcut-ref attribute of the child element is used to specify an existing [pointcut name].
  3. In the Spring configuration file, the configuration aspect uses the [ ] element.
  4. In Spring, using [ProxyBeanFactory  ProxyFactoryBean ] is the basic way to create AOP proxy.
  5. [Advice] in AOP terminology means the enhanced processing performed by the AOP framework at a specific entry point, that is, the program code to be executed at the defined entry point.
  • True or False
  1. If multiple advices need to be executed at the same join point, then in the same aspect, the execution order of the pre-advice and surrounding advice before the target method is unknown, and the execution order of the post-advice and surrounding advice after the target method Also unknown. ( 1 )
  2. The annotation @After in the AspectJ framework is used to define the final final notification, which will be executed regardless of whether it is abnormal or not. ( 1 )
  3. The elements in the Spring configuration file can contain multiple elements, and an element can contain attributes and sub-elements, and its sub-elements include , and . ( 1 )
  4. The AOP proxy in Spring is implemented by using CGLIB proxy by default. (0) JDK
  5. After Spring 3.0 , Spring AOP introduces support for AspectJ and allows direct use of AspectJ for programming, and Spring's own AOP API is also consistent with AspectJ as much as possible. (0) 2.0
  • multiple choice
  1. The following are not among the commonly used configurable properties in the ProxyFactoryBean class. ( D ) C

A: target

B: proxyInterfaces

C: targetClass

D: interceptorNames

  1. Which of the following types is not an advice type in Spring. (D)

A: Exception notification

B: Advance notice

C: post notification

D: Final notice

  1. Regarding the introduction of AspectJ annotations, the statement is wrong. (D)

A: @Aspect is used to define an aspect                

B: @Pointcut is used to define pointcut expressions

C: @Before is used to define pre-advice, which is equivalent to BeforeAdvice           

D: @After is used to define post-advice, which is equivalent to AfterReturningAdvice

  1. Which of the following statements about CGLIB proxy is correct. (B) BD

A: The use of CGLIB proxies is very simple, but it still has certain limitations - objects using dynamic proxies must implement one or more interfaces. 0

B: If you want to proxy a class that does not implement an interface, you can use CGLIB proxy. 1  

C: CGLIB is a high-performance open source code generation package, and it is necessary to import the packages required by CGLIB when using it. 0

D: The AOP proxy in Spring can be a JDK dynamic proxy or a CGLIB proxy. 1

  1. The following introduction about Spring AOP is wrong. (C)

A: The full name of AOP is Aspect-Oriented Programming, that is, aspect-oriented programming (also known as aspect-oriented programming).              

B: AOP adopts a horizontal extraction mechanism to extract the repeated code scattered in each method. This method of using a horizontal extraction mechanism cannot be achieved with OOP thinking.

C: Although AOP is a new programming idea, it adopts a horizontal extraction mechanism and is an upgraded replacement for OOP.     

D: There are currently two most popular AOP frameworks, namely Spring AOP and AspectJ.

  • short answer questions
  1. Please give a brief description of Spring's advice types.
  1. Spring database development

exercise

  • fill in the blank
  1. The JdbcTemplate class also provides a large number of [query()] methods to handle various query operations on database tables.
  2. The [update()] method in the JdbcTemplate class can complete the operations of inserting, updating and deleting data.
  3. [ @Test ] is the annotation used by Junit4 for testing. To test which method, you only need to add this annotation to the corresponding test method.
  4. JDBC needs 4 basic attributes when connecting to the database, including [driverClassName], url, username and password.
  5. The inheritance relationship of the JdbcTemplate class is very simple. It inherits from the abstract class [JdbcAccessor] and implements the JdbcOperations interface.
  • True or False
  1. When using Junit for a single test, the progress bar of the JUnit view window is green, indicating that the running result is correct; if the progress bar is red, it indicates that there is an error, and the reported error message will be displayed in the window. ( 1 )
  2. When defining jdbcTemplate, dataSource needs to be injected into jdbcTemplate. ( 1 )
  3. The JdbcOperations interface defines a collection of operations that can be used in the JdbcTemplate class, including operations such as adding, modifying, querying, and deleting. ( 1 )
  4. The JdbcTemplate class also provides a large number of query () methods to handle various query operations on database tables. ( 1 )
  5. In the JdbcTemplate class, a large number of methods for updating and querying the database are provided, and we use these methods to operate the database . ( 1 )
  • multiple choice
  1. The Spring JDBC module mainly consists of 4 packages, which are not included. (C)

A: core (core package)

B: dataSource (data source package)

C: driverClass (database driver package)

D: support (support package)

  1. The immediate parent class of JdbcTemplate is . (A)

A: JdbcAccessor

B: JdbcOperations

C: JdbcSupper

D: Object

  1. In which package of the Spring JDBC module the JdbcTemplate class is contained. (A)

A: Core package

B: Data source package

C: object package

D: support package

  1. The following description of the update() method is wrong. (A)

A: The update() method can complete the operations of inserting, updating, deleting and querying data

B: In the JdbcTemplate class, a series of update() methods are provided

C: After the update() method is executed, it will return the number of affected rows

D: The parameter returned by the update() method is of type int

  1. In the following description, the statement about the query() method is wrong. (D) C

A: List query(String sql, RowMapper rowMapper) will execute the SQL statement provided by the String type parameter, and return a List type result through RowMapper. 

B: List query (String sql, PreparedStatementSetter pss, RowMapper rowMapper) will create a PreparedStatement object according to the SQL statement provided by the String type parameter, and return the result to the List through RowMapper.  

C: List query (String sql, Object[] args, RowMapper rowMapper) will bind the args parameter to the SQL statement, and return a single row record of Object type through RowMapper .

D: queryForList (String sql, Object[] args, class elementType) can return the result of multiple rows of data, but it must be a return list, and the elementType parameter returns the List element type.

  • short answer questions
  1. Please briefly describe how to use Junit to test the methods in the program.
  1. Spring transaction management

exercise

  • fill in the blank
  1. To use annotation-based transaction management, you need to add annotations [  @Transactional     ] to the Spring Bean class or the method of the Bean class that uses the transaction.
  2. Spring's declarative transaction management can be implemented in two ways, one is based on XML, and the other is based on [   Annotation     ]. 
  3. After Spring 2.0, the tx namespace is provided to configure transactions, and the [ ] element is provided under the tx namespace to configure transaction notifications (enhanced processing).
  4. In all JAR packages of Spring, there is a      JAR package named [ spring-tx-RELEASE ], which is the dependency package provided by Spring for transaction management.
  5. Declarative transaction management:      transaction management realized through [ AOP technology ].
  • True or False
  1. XML-based declarative transaction management is realized by configuring related statements of transaction rules in configuration files. ( 1 )
  2. Programmatic transaction management is transaction management implemented by writing code, including defining the start of a transaction, transaction submission after normal execution, and transaction rollback when an exception occurs. ( 1 )
  3. Spring's transaction management simplifies the traditional transaction management process and reduces the workload of developers to a certain extent. ( 1 )
  4. Spring's declarative transaction management can be implemented in two ways, one based on XML and the other based on Annotation. ( 1 )
  5. When the @Responsebody annotation is used in conjunction with the @RequestMapping annotation, the return value of the method will be available on the page. ( 1 )
  • multiple choice
  1. The following is correct about the configurable parameter information and seconds of the @Transactional annotation. ( D ) A

A: value is used to specify the transaction manager to be used, the default is "";

B: read-only is used to specify whether the transaction is read-only, the default is true ;

C: isolation is used to specify the isolation level of the transaction, the default is Isolation.READ_COMMITTED;

D: propagation is used to specify the propagation behavior of the transaction, the default is Propagation. SUPPORTS;

  1. The description of the sub-element attribute of the element in the following XML-based declarative transaction management configuration file is wrong. ( A ) B

A: name: This attribute is a required attribute, which specifies the method name related to the transaction attribute

B: propagation: used to specify the propagation behavior of the transaction, its default value is SUPPORTS REQUIRED

C: isolation: This attribute is used to specify the isolation level of the transaction, and its default value is DEFAULT

D: read-only: This attribute is used to specify whether the transaction is read-only, and its default value is false

  1. Which of the following statements about transaction management methods is incorrect. (B)

A: There are two types of transaction management in Spring: one is traditional programmatic transaction management, and the other is declarative transaction management.

B: Programmatic transaction management: transaction management implemented through AOP technology , that is, transaction management implemented by writing code, including defining the start of a transaction, transaction submission after normal execution, and transaction rollback when an exception occurs.

C: Declarative transaction management: The main idea is to write transaction management as a "aspect" code separately, and then implant the "aspect" code of transaction management into the business target class through AOP technology.

D: The biggest advantage of declarative transaction management is that developers do not need to manage transactions through programming. They only need to declare relevant transaction rules in the configuration file to apply transaction rules to business logic.

  1. The following statements about Spring transaction management and core interfaces are wrong. (D)

A: The PlatformTransactionManager interface is a platform transaction manager provided by Spring, which is mainly used to manage transactions.

B: The TransactionDefinition interface is an object of transaction definition (description), which defines transaction rules and provides methods for obtaining transaction-related information.

C: The TransactionStatus interface is the status of the transaction, which describes the status information of the transaction at a certain point in time.

D: In the transaction management process, the propagation behavior can control whether and how to create a transaction. Usually, transaction management must be performed for data query , insert, update and delete operations.

  1. Which of the following options is not a core interface for transaction management in Spring. (D)

A: PlatformTransactionManager

B: TransactionDefinition

C: TransactionStatus

D: TransactionManager

  • short answer questions
  1. Please list the transaction operation methods provided by the PlatformTransactionManager interface, and give a brief description of these methods.
  1. Getting to know MyBatis for the first time

exercise

  • fill in the blank
  1. The deletion operation of MyBatis is realized by configuring the [ ] element in the mapping file.
  2. The element in the MyBatis mapping file is the root element of the configuration file, which contains a [   namespace    ] attribute, which specifies a unique namespace for this.
  3. Using the [ concat() ] function in MySQL      for string concatenation can effectively prevent SQL injection problems that may occur during fuzzy queries.
  4. mybatis-config.xml, as the global configuration file of MyBatis , configures information such as the operating environment of MyBatis , the main content of which is to obtain [ database connection ] .     
  5. [   MyBatis    ] is one of the current mainstream Java persistence layer frameworks. Like Hibernate , it is also an ORM framework .
  • True or False
  1. The element in the MyBatis mapping file is the root element of the configuration file, which contains a namespace attribute, which specifies a unique namespace for this. (0)
  2. It is very simple to use the MyBatis framework. You only need to introduce all the JAR packages and database driver packages in the lib directory of the MyBatis framework to the application to run the project. (1) 0 MyBatis core JAR package
  3. ORM is a technology to solve the mismatch of data types in object-oriented and relational databases. It automatically persists objects in Java applications to tables in relational databases by describing the mapping relationship between Java objects and database tables. middle. ( 1 )
  4. The update operation of MyBatis also requires transaction submission. ( 1 )
  5. The SQL statements in the created mapping file should be written in an object-oriented way. (0)
  • multiple choice
  1. The deletion operation of MyBatis said that there was an error. (D)

A: The deletion operation of MyBatis is implemented through configuration elements in the mapping file.

B: The deletion operation of MyBatis also requires transaction submission.

C: The delete operation of MyBatis executes the delete() method of SqlSession.

D: The deletion and addition operations of MyBatis also need to encapsulate the entire entity class .

  1. The update operation of MyBatis is about sending errors. (D)

A: The update operation of MyBatis is implemented through configuration elements in the mapping file.       

B: The update operation of MyBatis also requires transaction submission.

C: The update operation of MyBatis executes the update() method of SqlSession. 

D: When updating and adding operations of MyBatis, you only need to change the insert() method to the update() method.

  1. Regarding the splicing of SQL strings in MyBatis fuzzy queries, the statement is wrong. (C)

A: When using "${}" for SQL string concatenation, SQL injection cannot be prevented.

B: You can use the concat() function in MySQL to concatenate strings.

C: Using the concat() function in MySQL for string concatenation cannot prevent SQL injection.

D: Use the concat() function in MySQL to concatenate strings, resulting in poor database portability.

  1. The statement about how MyBatis works is wrong. ( D ) C

A: The global configuration file of MyBatis configures information such as the operating environment of MyBatis, the main content of which is to obtain database connections

B: The SQL statement for operating the database is configured in the MyBatis mapping file, which needs to be loaded in the global configuration file of MyBatis before execution

C: The session object SqlSession SqlSessionFactory can be constructed through MyBatis environment and other configuration information

D: SqlSession object, which contains all the methods to execute SQL

  1. After using the ORM framework, the application no longer directly accesses the underlying database, but operates the persistent object (PO, Persisent Object) in the way of (). ( D ) C

A: Business-oriented B: Hibernate C: Object-oriented D: MyBatis

  • short answer questions
  1. Please briefly describe the main differences between the two frameworks, Hibernate and MyBatis.
  1. The core configuration of MyBatis

exercise

  • fill in the blank
  1. When the columns in the data table are not completely consistent with the properties of the object to be returned, MyBatis will not automatically assign values. At this point, you can use the [ ] element for processing.
  2. The sub-element of the element is used to indicate which column is the [primary key], and the [ ] element is used to indicate the mapping relationship between POJO and ordinary columns in the data table.
  3. The [ refid ] attribute of the element used in the MyBaits mapping file   can refer to a custom code fragment, and its attribute value is the id of the custom code fragment.
  4. The order attribute of the child elements in the MyBatis mapping file can be set to [   BEFORE    ] or [  AFTER     ].
  5. For data source configuration, the MyBatis framework provides three data source types: UNPOOLED, [POOLED] and JNDI.
  • True or False
  1. The sub-elements of and the association relationship when dealing with multiple tables . (0) 1
  2. The attributes of the elements of the MyBatis mapping file are mostly the same as the attributes of the element, but it also contains 3 unique attributes . (0) 1
  3. The MyBatis framework provides many default aliases. Since the aliases are not case-sensitive, you should pay attention to the coverage problem of repeated definitions when using them . ( 1 )
  4. A mapping file can contain multiple elements with the same id value. (0)
  5. Like elements, and elements will also return an integer representing the number of affected records after execution. ( 1 )
  • multiple choice
  1. Which of the following statements about elements is incorrect. ( D ) C

A: The role of the element is to define a reusable SQL code fragment, and then refer to this code fragment in other statements.

B: Use the refid attribute of the element to refer to a custom code snippet.

C: Use the attribute value of the element refid as the name of the custom code snippet . id

D: The element is a child element of the element.

  1. The following statement about the elements in the MyBatis mapping file is correct. (C)

A: The element is used to map the insert statement. After executing the SQL statement defined in the element, no result is returned .

B: The attribute of the element is the same as the attribute of the element.

C: The keyColumn attribute is used to set which column is the primary key, and it needs to be set when the primary key column is not the first column in the table.

D: useGeneratedKeys (only useful for insert ) This property will cause MyBatis to use JDBC's getGeneratedKeys() method to obtain the primary key generated internally by the database. insert and update

  1. Which of the following statements about elements and their attributes is incorrect. (C)

A: Elements are used to map query statements, which can help us read data from the database and assemble the data to business developers.

B: The parameterType attribute indicates the fully qualified name or alias of the parameter class passed into the SQL statement.

C: resultMap represents the named reference of the external resultMap, and resultType and resultMap          can be used at the same time when returning

D: Multiple elements can be configured in the same mapping file.

  1. The statement about the elements is wrong. (D)

A: The element is used to register a custom type processor in the configuration file, and it can be used in two ways. 

B: A single type handler can be configured through the child elements of the element.  

C: All type processors under the package can be configured through the child elements of the element.  

The handler attribute of the sub-element of the D: element is used to specify the package name where the type handler is located, and the system will automatically scan all files under the com.iheima.type package at startup and use them as type handlers. name

  1. What is wrong about the elements in the MyBatis configuration file is. (C)

A: Elements are mainly used to change the behavior of MyBatis runtime, such as enabling secondary cache, enabling lazy loading, etc.

B: Although MyBatis can run normally without configuring elements, familiar configuration content and their functions are still very necessary.

The parameter lazyLoadingEnabled of the global switch for lazy loading in the C: element is enabled by default .

D: Most of the configuration content of the element does not require developers to configure it, and usually only a few items can be configured when needed.

  • short answer questions
  1. Please briefly describe the function and use of the elements.
  1. Dynamic SQL

exercise

  • fill in the blank
  1. When the element is used in the MyBaits file, the [ name ] attribute value of the element can be directly referenced in the SQL statement      to perform dynamic SQL assembly.
  2. When using MyBaits, if there are multiple parameters passed in, they need to be encapsulated into a Map, and the value of the collection attribute is the [   key    ] of the Map.
  3. When using the combination of and elements in the MyBaits mapping file for dynamic SQL assembly of the update statement, if the contents contained in the elements are all empty, [SQL syntax error] will appear.
  4. The function of the elements in MyBaits is to remove some special strings. Its [ prefix ] attribute represents the prefix of the statement, and the prefixOverrides attribute represents the special strings that need to be removed.
  5. When the update statement is combined with the element, the element will dynamically prepend the [ SET    ] keyword, and the last redundant [ comma ] in the SQL statement will also be eliminated.
  • True or False
  1. Any iterable object (such as a list, collection, etc.) and any dictionary or array object can be passed as the collection parameter. (0) 1
  2. When using the combination of and elements in the MyBaits mapping file for dynamic SQL assembly of the update statement, if the content contained in the elements is empty, an SQL syntax error will occur. ( 1 )
  3. The "where 1=1" condition in the original SQL in MyBaits can be replaced by combining with elements. ( 1 )
  4. In MyBatis, elements are used for single-condition branch judgment. When a certain test attribute is judged to be true, then other elements are skipped for dynamic SQL assembly. (0)
  5. Elements in MyBatis can be used to loop through arrays and collections, and perform SQL operations in batches. ( 1 )
  • multiple choice
  1. Which of the following is not an attribute used in an element is. (C)

A: separator

B: collection

C: current

D: item

  1. The following descriptions of several attributes used in elements are wrong. (A) C

A: item: The configuration is the current element in the loop.            

B: index: The configuration is the subscript of the position of the current element in the collection.

C : collection: The configuration is the passed parameter type, which can be an array, list (or collection), the key of the Map collection, the property name of the array or collection type in the POJO wrapper class, etc.               

D: separator: The configuration is the separator of each element.

  1. The following uses and statements about the elements of MyBatis are correct. (C) A

A: The element is mainly used for update operations, and its main function is to output a SET keyword before the dynamically included SQL statement and remove the last redundant comma in the SQL statement.

B: When using MyBatis elements to update operations, the front end needs to pass in all parameter fields, otherwise the fields that are not passed in will be set to empty by default.

C: When using and element combination in the mapping file for dynamic SQL assembly of the update statement, the content contained in the element can be empty , and the element will be judged and processed.

D: When updating the mapping file, dynamic SQL assembly can be performed only by using elements.

  1. The following statement about the main elements in MyBatis dynamic SQL is wrong. (D)

A: Used for single-condition branch judgment.

B: (,) is used for multi-condition branch judgment.

C: Loop statement, often used in enumeration conditions such as in statement.

D: Create a variable from an OGNL expression and bind it to the context, only in the sql of the fuzzy query.

  1. When there are multiple options and the value needs to be selected from multiple options to execute, the dynamic SQL element that can be used is. (B)

A:

B: 、、

C:

D:

  • short answer questions
  1. Please briefly describe the main elements and descriptions in MyBatis dynamic SQL.
  1. Association mapping of MyBatis

exercise

  • fill in the blank
  1. MyBatis handles the many-to-many relationship through the [ ] sub-element of the element.
  2. MyBatis handles the one-to-one relationship through the [ ] sub-element of the element.
  3. In a relational database, the many-to-many relationship will generate an [intermediate relationship] table, introduce the primary key of the two tables as a foreign key, and the two primary keys become a joint primary key or use a new field as the primary key.
  4. In a relational database, one-to-one can introduce the primary key of the other party as a foreign key in [any party].
  5. The ofType attribute of the child element corresponds to the javaType attribute, which is used to specify the [element type] contained in the collection class attribute in the entity object.
  • True or False
  1. MyBatis also handles the many-to-many relationship through the sub-element of the element. ( 1 )
  2. MyBatis loads relationship objects in the mapping file mainly in two ways: nested query and nested result. ( 1 )
  3. In a relational database, one-to-many means adding the primary key of the "many" side as a foreign key on the "one" side. (0)
  4. The attributes of elements in MyBatis are the same as those of elements, and it is also very simple to use. There are also two association methods of nested queries and nested results. (0)
  5. MyBatis handles the one-to-one relationship through the child element of the element. ( 1 )
  • multiple choice
  1. The following statement about the element attributes in the MyBatis mapping file is wrong. (D)

A: property: Specifies the attribute of the entity class object to which it is mapped, corresponding to the table fields one by one.

B: column: Specify the corresponding field in the table.

C: javaType: Specifies the type mapped to the attribute of the entity object.

D: fetchType: Specifies whether to enable lazy loading when associating queries. The fetchType attribute has two attribute values, lazy and eager, and the default value is eager .

  1. The following statement about the relationship between multiple tables in the database is wrong. (B)

A: A one-to-one relationship can introduce the other party's primary key as a foreign key on either side.

B: The one-to-many relationship is on the "one" side, and the primary key of the "many" side is added as a foreign key.

C: A many-to-many association will generate an intermediate relational table, and introduce the primary keys of the two tables as foreign keys.

D: The primary key of the two tables in the many-to-many relationship can be a joint primary key or use a new field as the primary key.

  1. Which of the following descriptions about the relationship between Java objects is correct. (B)

A: A one-to-one relationship is to define objects of the same type in this class and the other class.

B: A one-to-many relationship is the case where one class A type corresponds to multiple class B types.

C: A many-to-many relationship only needs to introduce a collection of the other type in one class.

D: The many-to-many relationship needs to introduce the collection of this class in this class.

  1. The following attributes are not element attributes. (C)

A: property

B: column

C: ofType

D:javaType

  1. The following description about the elements is correct. (A)

A: MyBatis handles one-to-many relationships through elements.

B: The attributes of the element are exactly the same as the element.

C: The ofType attribute corresponds to the javaType attribute, which is used to specify the element type contained in all attributes in the entity object.

D: Elements can only use the nested query method.

  • short answer questions
  1. Please briefly explain how MyBatis loads the relationship objects in the mapping file.
  1. Integration of MyBatis and Spring

exercise

  • fill in the blank
  1. In the MyBatis+Spring project, transactions are      managed by 【 Spring 】.
  2. The MyBatis-Spring team provides a form of automatic scanning to configure the mapper in MyBatis - using the [    MapperScannerConfigurer   ] class.
  3. MapperFactoryBean     ] is a class provided by the MyBatis-Spring team for generating Mapper objects based on the Mapper interface.
  4. SqlSessionDaoSupport is an abstract support class, you can get the required SqlSession through the [getSqlSession()] method of the SqlSessionDaoSupport class.
  5. When integrating Spring and MyBatis, the Spring framework needs to prepare a total of 10 JAR packages, including: 4 core module JARs, JARs used for AOP development, [JDBC] and transactional JARs.
  • True or False
  1. The parameter SqlSessionTemplate of MapperFactoryBean is used to specify SqlSessionTemplate. If set at the same time as SqlSessionFactory, only SqlSessionFactory will be enabled . (0)
  2. When MyBaits is integrated with Spring, the Dao layer development can use the traditional DAO development and integration, and the Mapper interface development integration. ( 1 )
  3. You can use the SqlSessionTemplate class or SqlSessionDaoSupport class provided in the mybatis-spring package to inject SqlSessionFactory into the DAO implementation class. ( 1 )
  4. In actual project development, Spring and MyBatis are integrated and used together. (1 )
  5. MapperFactoryBean is a class provided by the MyBatis-Spring team for generating Mapper objects based on the Mapper interface. ( 1 )
  • multiple choice
  1. MapperFactoryBean is a class provided by the MyBatis-Spring team to generate Mapper objects based on the Mapper interface. The parameters of this class that can be configured in the Spring configuration file are not included. (D)

A: mapperInterface

B: SqlSessionFactory

C: SqlSessionTemplate

D: basePackage

  1. When the MapperScannerConfigurer class is used in the Spring configuration file, the attributes and descriptions that can be configured are wrong. (D)

A: basePackage: Specify the package path where the mapping interface file is located. When scanning multiple packages, you can use a semicolon or comma as a separator.

B: annotationClass: Specifies the name of the annotation to be scanned, and only the class identified by the annotation will be configured as a mapper.

C: sqlSessionFactoryBeanName: Specifies the Bean name of the SqlSessionFactory defined in Spring.

D: sqlSessionTemplateBeanName: Specifies the Bean name of the SqlSessionTemplate defined in Spring. sqlSessionFactoryBeanName will work if this property is defined

  1. In the MyBatis+Spring project, the following statements about transactions are correct. (C)

A: In the MyBatis+Spring project, transactions are managed by MyBatis .

B: In the project, the data access layer is not only the place to process business, but also the place to manage database transactions.

C: When developing annotations, you need to configure the transaction manager in the configuration file and enable transaction annotations.

D: When developing annotations, you need to use @Transactional annotations to identify classes in the presentation layer.

  1. The following do not belong to the MapperScannerConfigurer class, but the properties that need to be configured when used in the Spring configuration file are. (D)

A: basePackage

B: annotationClass

C: sqlSessionFactoryBeanName

D: mapperInterface

  1. The following statements about the integration of MyBatis and the Spring framework using the traditional DAO development method are wrong. (A)

A: When using the traditional DAO development method to integrate MyBatis with the Spring framework, you only need to write the DAO interface. and the implementation class of the interface

B: When using the traditional DAO development method to integrate MyBatis with the Spring framework, you need to inject SqlSessionFactory into the DAO implementation class, and then create SqlSession through SqlSessionFactory in the method body.

C: You can use the SqlSessionTemplate class or SqlSessionDaoSupport class provided in the mybatis-spring package to inject SqlSessionFactory into the class.

D: SqlSessionDaoSupport is an abstract support class that inherits the DaoSupport class and is mainly used as the base class of DAO. The required SqlSession can be obtained through the getSqlSession() method of the SqlSessionDaoSupport class.

  • short answer questions
  1. Please give a brief introduction to the two classes SqlSessionTemplate and SqlSessionDaoSupport provided in the mybatis-spring package.
  1. Getting Started with Spring MVC

exercise

  • fill in the blank
  1. After the front controller intercepts the request, it will call [   HandlerMapping    ].
  2. Spring MVC supports a variety of view technologies, including [JSP], Velocity and FreeMarker, etc.
  3. In the configuration file of Spring MVC, you can configure processor mapping, processor mapper, processor adapter and [view resolver].
  4. Spring MVC provides a front controller [DispatcherServlet], so that developers do not need to develop additional controller objects.
  5. In the execution process of Spring MVC, after the Controller is executed, it will return a [ModerAndView] object.
  • True or False
  1. HandlerAdapter returns ModelAndView object to ViewReslover . (1 0 ) DispatcherServlet  
  2. In the configuration file of Spring 4.3, the processor mapper, processor adapter and view resolver must be configured, otherwise the program will not run . (0)
  3. A 1 in the element means that the container loads this servlet immediately at startup. ( 1 )
  4. Spring MVC supports view technologies such as JSP, Velocity, XML , and FreeMarker. (0)
  5. Spring MVC is less flexible and easy to integrate with other frameworks. (0)
  • multiple choice
  1. The following statement about the characteristics of Spring MVC is wrong. (A)

A: Strong flexibility, but not easy to integrate with other frameworks

B: It can automatically bind user input and convert data types correctly

C: supports internationalization

D: 使用基于XML的配置文件,在编辑后,不需要重新编译应用程序

  1. Spring MVC中的后端控制器是指。( D )

A: HandlerAdapter

B: DispatcherServlet

C: ViewReslover

D: Handler

  1. 用户通过浏览器向服务器发送请求时,负责拦截用户请求的是。( B )D

A: 处理器

B: 处理器映射器

C: 处理器适配器

D: 前端控制器

  1. 入门程序中,不是必须引入的JAR包是。( D )

A: Spring的4个核心JAR包

B: commons-logging的JAR包

C: spring-web和spring-webmvc的JAR包

D: log4j的JAR

  1. Spring MVC是Spring提供的一个实现了( A )设计模式的轻量级Web框架。

A: Web MVC

B: Web

C: 单例

D: 工厂

  • 简答题
  1. 请简述Spring MVC的特点。
  1. Spring MVC的核心类和注解

习题

  • 填空题
  1. RequestMapping注解类型用于映射【    一个请求或一个方法  】。
  2. 在使用Spring MVC的注解开发时,除了需要引入Spring的核心JAR包、Commons-logging的JAR包以及Spring MVC的2个JAR包外,还需要引入【  Spring AOP    】的JAR包。
  3. 在视图解析器配置中,可以设置视图的【  前缀和后缀    】。
  4. 如果没有通过元素配置,则应用程序会默认去【   WEB-INF目录下   】寻找配置文件。
  5. 如果元素不存在,则应用程序会【  在第一个Servlet请求时    】加载该Servlet。
  • 判断题
  1. In the controller class, each request processing method can have multiple parameters of different types, and a return result of multiple types. ( 1 )
  2. The method attribute of @RequestMapping must be used. (0)
  3. @RequestMapping(method = RequestMethod.GET) can be abbreviated as @GetMapping. ( 1 )
  4. The attributes of the @RequestMapping annotation are optional attributes. (0) 1
  5. Elements and elements must be used in the Web.xml file, otherwise the file will report an error. (0)
  • multiple choice
  1. The following statement about the return type of the request processing method is wrong. (D)

A: Common return types are ModelAndView , String and void

B: Model data can be added to the ModelAndView type , and the view can be specified

C: The return value of String type can jump to the view, but cannot carry data

D: The void type is mainly used in asynchronous requests, it not only returns data, but also jumps to the view

  1. Among the following types, those that do not belong to the parameter type of the request processing method are. (D)

A: javax.servlet.http.HttpSession

B: @MatrixVariable

C: org.springframework.ui.Model

D: void

  1. Which of the following statements about combined annotations is correct. (B)

A: Combined annotations are a new feature in Spring 3.x

B: Combined annotations can simplify the mapping of commonly used HTTP methods

C: In all Spring projects, use composite annotations instead of @RequestMapping annotations

D: @GetMapping annotation can be used to match GET and POST requests

  1. The following statement about the @RequestMapping annotation is wrong. ( B ) D

A: The default attribute of @RequestMapping annotation is value

B: The value attribute value of @RequestMapping annotation can be omitted

C: The value attribute name of @RequestMapping annotation can be omitted

D: The value attribute of the @RequestMapping annotation must be marked

  1. The following statements about elements are wrong. (C)

A: If the value of the element is 1, the servlet will be loaded immediately when the application starts

B: If the element does not exist, the application will load the Servlet on the first Servlet request

C: If the element has a value of 1, the Servlet is lazy loaded at application startup

D: element is optional

  • short answer questions
  1. Please briefly describe the functions of the three return types of ModelAndView, String and void.
  1. data binding

exercise

  • fill in the blank
  1. When using collection data binding, the background method does not support directly using collection formal parameters for data binding, so you need to use a wrapper POJO as a formal parameter, and then wrap a [ collection ] attribute in the wrapper POJO      .
  2. When using wrapper POJO type data binding, if the front-end condition parameter is a sub-property of POJO in the wrapper class, the parameter name must be [object.property].
  3. When the parameters requested by the front end are relatively simple, you can directly use the [ default parameter     ] type provided by Spring MVC in the formal parameters of the background method for  data binding.
  4. If all the query conditions of the order and the user are encapsulated in a simple POJO, it will obviously be confusing. At this time, you can consider using the data binding of the [packaging POJO] type.
  5. When using POJO type data binding, the parameter name requested by the front end must be the same as the [property name] in the POJO class to be bound, so that the request data will be automatically bound to the POJO object, otherwise the parameter value received by the background It is [null].
  • True or False
  1. The parameters passed in the binding array are the same as those passed in the binding collection page, but the parameters of the background receiving method are different. (0)
  2. To use collection data binding, you need to define a collection containing user information classes in the wrapper class, and then define the parameter type as the collection of the wrapper class in the receiving method. ( 1 )
  3. In the binding array operation, the value of the name attribute passed in the check box in the foreground page must be the same. ( 1 )
  4. When registering a custom Formatter converter class, the Bean class name must be org.springframework.format.support.FormattingConversionServiceFactoryBean, and its property is formatters. ( 1 )
  5. Formatter has the same function as Converter, except that the source type of Formatter can be any type, while Converter must be a String type. (0)
  • multiple choice
  1. Which of the following statements about collection data binding in Spring MVC data binding is correct. (B)

A: When deleting user operations in batches, the parameters passed by the front-end request will contain multiple data of the same type. At this time, the form of array type data binding can be used

B: To use collection data binding, you need to define a collection type parameter in the background method. Introduction to binding front-end request parameters

C: The parameters passed by the binding array and the binding collection page are the same, but the parameters of the background receiving method are different

D: When using collection data binding, the background method does not support directly using collection parameters for data binding

  1. Which of the following options is Spring's encoding filter class. (B)

A: org.springframework.web.filter.EncodingFilter

B: org.springframework.web.filter.CharacterEncodingFilter

C: org.springframework.web.filter.CharacterEncoding

D: org.springframework.web.filter.CharacterFilter

  1. The attribute name can be omitted in the @RequestParam annotation. (B)

A: defaultValue

B: value

C: name

D: required

  1. The following statement about wrapping POJO type data binding is correct. (A)

A: If the query condition parameter is a direct basic attribute of the wrapper class, the parameter name directly uses the corresponding attribute name

B: If the query condition parameter is a direct basic property of the wrapper class, the parameter name must use the corresponding "object.property name"

C: If the query condition parameter is a sub-property of POJO in the wrapper class, the parameter name must be the property name

D: If the query condition parameter is a sub-property of POJO in the wrapper class, the parameter name must be in the form of "object. sub-property. property value"

  1. The following are not @RequestParam annotation type attributes. (A)

A: id

B: value

C: name

D: required

  • short answer questions
  1. Why do you need custom data binding?
  1. JSON data binding and RESTful support

exercise

  • fill in the blank
  1. RESTful style In the HTTP request, use [   put    ], delete, post and get methods to correspond to the operations of adding, deleting, modifying and querying respectively.
  2. When using the label configuration method to configure the JSON converter, you need to configure the processor mapper and the processor adapter at the same time, and the JSON converter is configured in [  Adapter     ].
  3. The array structure of the JSON object starts with "[" and ends with "]", and the middle part consists of a list of [   0 or more    ] values ​​separated by "," in English.
  4. The @PathVariable annotation is used to receive and bind request parameters, which can map [ variables ] in the request URL      to formal parameters of the method.
  5. In RESTful style, [ verbs ] cannot appear in HTTP requests      .
  • True or False
  1. The @PathVariable("id") annotation is used to receive and bind request parameters. If the parameter name and method parameter name in the request path are the same, the "("id")" behind @PathVariable can be omitted. ( 1 )
  2. The key (key) of the JSON object data structure must be of String type, and the value (value) can be of data types such as String, Number, Object, and Array. ( 1 )
  3. In the RESTful style, in the HTTP request, the put, delete, post, and get methods are used to correspond to the operations of adding, deleting, modifying, and querying, respectively. ( 1 )
  4. RESTful is also called REST, which is the abbreviation of "Representational State Transfer" in English. ( 1 )
  5. The MappingJackson2HttpMessageConverter class can only convert Java objects to JSON objects and XML documents, but cannot convert JSON objects and XML documents to Java objects. (0)
  • multiple choice
  1. For the GET RESTful style request http://localhost:8080/chapter14/user/1, it is feasible to write the path mapping of the parameters received by the background method. (C)

A: @RequestMapping("/user/{id}",method=RequestMethod.GET)。

B: @RequestMapping(value="/user/ids")。

C: @GetMapping(value="/user/{ids}")。

D: @GetMapping(value="/user/{id}",method=RequestMethod.GET)

  1. The following are RESTful style requests. (C)

A: http://.../queryItems?id=1

B: http://.../queryItems?id=1&name=zhangsan

C: http://.../items/1

D: http://.../queryitems/1

  1. 下面不属于AJAX中的属性的是。( D )

A: data

B: contentType

C: dataType

D: database

  1. 下面选项中不属于Jackson的开源包的是。(D  )

A: jackson-annoations-2.8.8.jar

B: jackson-core-2.8.8.jar

C: jackson-databind-2.8.8.jar

D: jackson-data-2.8.8.jar

  1. JSON对象结构中,关键字key必须为。( C )类型

A: Object

B: Array

C: String

D: Number

  • 简答题
  1. 请简述Spring中HttpMessageConverter接口的主要作用。
  1. 拦截器

习题

  • 填空题
  1. Spring MVC单个拦截器执行顺序中,在【   DispatcherServlet   】处理完请求后,才会执行afterCompletion()方法。
  2. Spring MVC中的拦截器(Interceptor)类似于Servlet中的【   过滤器   】,它主要用于拦截用户请求并作相应的处理。
  3. 用于如果没有登录系统而直接访问主页面,拦截器会将请求拦截,并转发到【   登录页面   】。
  4. 当有多个拦截器同时工作时,它们的【   preHandle()   】方法会按照配置文件中拦截器的配置顺序执行。
  5. 如果拦截器类中的preHandle()方法的返回值为【   true   】,则程序会继续向下执行处理器中的方法。
  • 判断题
  1. 在实现用户登录权限验证中,需要定义一个登录拦截器,并在拦截器的postHandle()方法中编写业务逻辑进行登录控制。( 0 )
  2. When configuring the interceptor, the attribute value of path must be set to /**. (0)
  3. When multiple interceptors are used, the postHandle() method and afterCompletion() method will be executed in the order of configuration. (0)
  4. The global interceptor and the interceptor under the specified path cannot be configured at the same time , otherwise an error will be reported at runtime. (0)
  5. Child elements in can be written in any position . (0)
  • multiple choice
  1. The following statement about the configuration of the interceptor in the Spring MVC configuration file is wrong. (B)

A: To use the interceptor in Spring MVC, you must first customize the interceptor and configure it in the configuration file.

The B: element is used to configure a set of interceptors, and its child elements define the interceptors for the specified path . global interceptor

C: Multiple child elements can be configured in an element at the same time.

The D: element is used to configure path requests that do not need to be intercepted.

  1. The following is not a method in the interceptor class. (D)

A: preHandler()

B: postHandle()

C: afterCompletion()

D: afterpletion()

  1. Which of the following methods can define interceptors in Spring MVC. ( B )

A: Inherit HandlerInterceptor

B: Implement WebRequestInterceptor

C: implements HandlerInterceptorAdapter

D: Inherit WebRequestInterceptor

  1. Which of the following statements about the execution flow of the interceptor is wrong. (C)

A: The program first executes the preHandle() method in the interceptor class.

B: If the return value of the preHandle() method is true, the program will continue to execute the method in the processor, otherwise it will no longer execute downward.

C: After the business processor (that is, the Controller class) processes the request, it will execute the preHandle() method.

D: After DispatcherServlet processes the request, the afterCompletion() method will be executed.

  1. Regarding the execution process of user authorization verification, the statement is wrong. (D)

A: Only logged-in users can access the main page in the system.

B: If you directly access the main page without logging in to the system, the interceptor will intercept the request and forward it to the login page.

C: If the user name or password is wrong, a corresponding prompt message will be given on the login page.

D: When the logged-in user clicks the "logout" link on the system homepage, the system will return to the main page .

  • short answer questions
  1. Please briefly describe and explain the methods in the HandlerInterceptor interface of the interceptor.
  1. File upload and download

exercise

  • fill in the blank
  1. Due to different versions of IE browsers, the keywords in the request agent [User-Agent] are also slightly different.
  2. The role of the ResponseEntity object is somewhat similar to the @ResponseBody annotation, which is used to directly return [result object].
  3. Due to the differences in the [ internal transcoding mechanism ] of each browser      , there will be different garbled characters and parsing exceptions.
  4. Use the [encoder(String s,String enc)] method in the URLEncoder class provided in the Servlet API to convert Chinese to UTF-8 encoding.
  5. The HttpStatus type represents the status in the Http protocol. HttpStatus.OK in the example means [200], that is, the server has successfully processed the request.
  • True or False
  1. When uploading a file, it must be ensured that the uploaded file does not have the same name. For this reason, the name of the uploaded file can be renamed through UUID or other means. ( 1 )
  2. The uploaded files can be found in the project directory. (0)
  3. The maximum size in the uploaded file cache can be set through the maxUploadSize attribute. (0) maxInMemorySize
  4. Spring MVC's file upload is implemented through the MultipartResolver object. ( 1 )
  5. Spring MVC needs to implement file upload through third-party components. (0)
  • multiple choice
  1. The following statement about the MultipartFile interface is wrong. (B)

A: getOriginalFilename() is used to obtain the initial name of the uploaded file.

B: getSize() is used to get the size of the uploaded file, the unit is KB. byte

C: getInputStream() is used to read the file content and return an InputStream stream.

D: transferTo(File file) is used to save the uploaded file to the target directory.

  1. The following belongs to the CommonsMultipartResolver property is. (D)

A: getContentType

B: getInputStream

C: isEmpty

D: defaultEncoding

  1. The following statement about the file upload form is wrong. (B)

A: The method attribute of the form form is set to post

B: The method attribute of the form form is set to get

C: The enctype attribute of the form form is set to multipart/form-data

D: Provided file upload input box

  1. The following description of the content of the file download method is wrong. (D)

A: The MediaType in the response header information represents the Interer Media Type (that is, the Internet media type), also known as the MIME type.

B: The value of MediaType.APPLICATION_OCTET_STREAM is application/octet-stream, which means to download data in the form of binary stream.

C: The HttpStatus type represents the status in the Http protocol.

D: HttpStatus.OK means 500 , that is, the server has successfully processed the request.

  1. The following is not part of the CommonsMultipartResolver property of the file resolver class. (D)

A:maxUploadSize

B:maxInMemorySize

C:defaultEncoding

D:lazy

  • short answer questions
  1. Please briefly describe the 3 conditions that the form needs to meet when uploading files.
  1. SSM framework integration

exercise

  • fill in the blank
  1. The integration of SSM framework is mainly the integration of [Spring and MyBatis], and the integration of [Spring MVC and MyBatis].
  2. In order to avoid the information in the Spring configuration file being too bloated, the information in the Spring configuration file is usually      dispersed in multiple configuration files according to [ different functions ].
  3. The @Transactional annotation is mainly for transaction management of [Add], [Modify], [Delete] of data.
  4. In the integration project, the db.properties file is mainly used for 【configure database constants】.
  5. When integrating Spring with the MyBatis framework, you can [   instantiate Bean    ] through Spring, and then call the query method in the instance object to execute the [SQL statement] in the MyBatis mapping file. If you can correctly query the data in the database, you can consider it The integration of Spring and MyBatis framework is successful.
  • True or False
  1. In actual development, in order to avoid the information in the Spring configuration file being too bloated, the information in the Spring configuration file is usually scattered in multiple configuration files according to different functions. ( 1 )
  2. The @Autowired annotation needs to be marked on the implementation class of the Service layer so that dependency injection can be achieved. (0)
  3. @Transactional注解主要是针对数据的增加、修改、删除和查询进行事务管理。( 0 )
  4. SpringSpring MVC,Spring MVC与MyBatis需要相互整合。(  0)
  5. 在Spring MVC的配置文件中,视图解析器是必须配置的。( 0 )
  • 选择题
  1. 下列选项中,不需要配置在web.xml中的是。( C )

A: Spring的监听器

B: 编码过滤器

C: 视图解析器

D: 前端控制器

  1. 下列选项中,属于Spring MVC所必须的JAR包的是。( A )

A: spring-web-4.3.6.RELEASE.jar

B: spring-webmvc-portlet-4.3.6.RELEASE.jar

C: spring-webmvc-4.3.6.RELEASE-javadoc.jar

D: spring-websocket-4.3.6.RELEASE.jar

  1. 下列选项中,不属于SSM整合时所需的JAR包的是。( D )

A: spring-web-4.3.6.RELEASE.jar

B: spring-webmvc-4.3.6.RELEASE.jar

C: ant-1.9.6.jar

D: xwork-core-2.3.24.jar

  1. 下列关于SSM框架的整合说法错误的是。( D )

A:Spring MVC与Spring之间不存在整合的问题。

B:SSM框架的整合就涉及到Spring与MyBatis的整合。

C:SSM框架的整合就涉及到Spring MVC与MyBatis的整合。

D:SSM框架的整合就涉及到Spring MVC与Spring之间的整合。

  1. 下面选项中,不属于整合SSM框架所编写的配置文件的是。(D  )

A:db.properties

B:applicationContext.xml

C:mybatis-config.xml

D:struts.xml

  • 简答题
  1. 请简述SSM框架整合思路。
  1. BOOT客户管理系统

习题

  • 填空题
  1. 系统中主要实现了两大功能模块:【   用户登录模块   】和【    客户管理模块  】。
  2. 【   @Responsebody   】注解一般在异步获取数据时使用。
  3. 在BOOT客户管理系统中,新建客户信息窗口是通过【   Bootstrap   】的模态框代码实现的。
  4. 查询操作通常可以分为按条件查询和【   查询所有   】。
  5. 在实际应用中,无论是企业级项目,还是互联网项目,使用最多的一定是【   查询操作   】。
  • 判断题
  1. 删除操作只需将所需删除客户的id信息传递给后台删除方法即可。( 1 )
  2. 修改操作时,修改信息窗口中的数据需要清空。( 0 )
  3. @Responsebody注解与@RequestMapping注解配合使用时,页面中将可以获取到方法的返回值。( 1 )
  4. 通常在系统中,查询出的数据都会分页显示。( 1 )
  5. 在设置事务的传播行为时,需要将与查询相关方法的read-only属性值设置为true。( 1 )
  • 选择题
  1. 拦截用户请求是在哪一层次中实现的。( D )

A: 持久对象层

B: 数据访问层

C: 业务逻辑层

D: Web表现层

  1. 下列选项中,不属于BOOT客户管理系统中功能的是。( B )

A: 用户登录

B: 用户管理

C: 查询客户

D: 修改客户

  1. 下面选项中,关于Web表现层说法错误的是。( C

A: 该层主要包括Spring MVC中的Controller类和JSP页面。

B: Controller类主要负责拦截用户请求。

C: Controller类会调用业务逻辑层中相应组件的业务逻辑方法来处理用户响应。

D: Controller类会将请求的结果返回给JSP页面。

  1. 下列关于BOOT客户管理系统用户登录模块说法错误的是。( D )

A:用户登录过程中首先要验证用户名和密码是否正确,如果正确,可以成功登录系统,系统会自动跳转到主页。

B: During the user login process, the user must first verify whether the user name and password are correct. If they are wrong, an error message will be given on the login page.

C: In order to ensure the security of the system, the login verification must be implemented when the user logs in.

D: In order to ensure the stability of the system, the login verification must be implemented when the user logs in.

  1. Which of the following statements about the customer management module is correct. (A)

A: Query operations can usually be divided into conditional query and query all.

B: When adding a customer operation, the customer information needs to be echoed in the new customer information window.

C: When modifying a customer, all customer information must be modified before saving and modifying can be performed.

D: When deleting a customer, only the state of the data in the data table is changed, and the data in the database is not deleted.

  • short answer questions
  1. Please briefly describe how to implement login verification.

おすすめ

転載: blog.csdn.net/Vivien_CC/article/details/118174444