Project scene:
Construction of ssm framework
Project scenario: configure the springmvc environment (the first step must be to introduce the jar package)
Problem Description:
- Error in header tag when creating xml file manually
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
</beans>
-
The reason why application context not configured for this file is used in the spring framework
-
Run tomcat error 404
-
The action cannot jump to the corresponding controller
-
Error creating bean with name'controller name'
-
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'loginController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [F:\gradute-students\gradute-student\graduate-student-mvc\out\artifacts\graduate_student_mvc_war_exploded\WEB-INF\classes\com\d\mapper\UserMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sqlSessionFactory' available
Cause Analysis:
- Uniform Resource Identifier is not registered
- The file is not configured in the project
- The path setting error in the <welcome-file-list> tag causes the access page to not exist
- The database query was empty, the method returned null, and the logic behind did not return to the page, but directly returned null, causing an error.
- The service layer is not annotated, and the business implementation layer cannot be found
- SqlSessionFactory is not configured
solution:
1.1 Manually add
file–>setting–>languages & frameworks–>Schemas and DTDs,
click on the "+" sign, and add the red part of the error report.
1.2. Using software
In the red part alt+enter select Fetch external resource (to obtain external resources
) to solve
2. Add the file to the project
Enter the project structure, which is the project structure
Click modules->spring, the following prompts that applicationContext-transaction.xml is not configured.
Click Modify and configure the unconfigured files to it to solve the problem.