Tag Archives: maven

[Solved] Maven Project Error: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

Tomcat does not publish the jar package added by Maven dependency when publishing the project

Solution:

eclipse project right click -> properties -> Deployment Assembly -> Add -> Java Build Path Entries -> select Maven Dependencies -> Apply -> Finish -> it’s OK
This will publish the corresponding Maven dependencies to tomcat, and tomcat will be able to find the dependencies

Special case: tomcat service (Servers) has more than one project, will also report such an error, the project does not need to start to remove can be

Vue Browser Error: Failed to load resource: the server responded with a status of 404 (Not Found)

When you create a maven project in idea and use Vue to modify the content in HTML, you find that the HTML page is not modified successfully. F12 opens the background and displays an error: failed to load resource: the server responded with a status of 404 (not found). The browser does not find Vue JS file
reason:
(1) maven project to introduce vue.js file after the project needs to be packaged, double-click the package button.

(2) Since the vue.js file is stored in a static resource, check whether the project’s configuration file springMVC.xml opens access to the static resource.

After completing the above steps, the browser F12 background shows that vue.js was successfully fetched and the page content was successfully modified!

[Solved] Error creating bean with name ‘mvcContentNegotiationManager‘: Lookup method resolution failed

Recently, I encountered various strange exceptions when I used idea to build an aggregation project. Here is an exception reported by the operation of its sub module:

The prompt of exception information is:

Error creating bean with name ‘mvcContentNegotiationManager’: Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean] from ClassLoader [sun.misc.Launcher$ AppClassLoader@18b4aac2 ]

Solution 1:

Check whether the POM file of the sub module depends on the parent class. Of course, many people will find that when wearing the submodule, the POM file of the sub module will automatically depend on the parent class (as shown in the figure below)

If the dependency in the above figure is not automatically generated after inspection, and you have the same exception as me, then the parent project dependency is added to solve the exception with a high probability

After consulting relevant posts on the Internet and repeated experiments for many times, I found that:

This bug is because we created a module with the same name before, and then we removed it. Then we automatically generate webapp module through the skeleton, so that the module generated by the skeleton will completely overwrite your original POM file!!!

Unfortunately, you need the parent project dependency to start the project, then you will have this bug!

The safest and most reliable solution to avoid problem reproduction: check the dependency of POM file every time you create a sub module. If not, solve it manually

Of course, there are various online solutions, but I have tried and found that it can temporarily solve the problem, but it will still be overwritten the next time I use the skeleton to generate a module with the same name

Solution 2 (slightly reliable):

Setting — build — Maven — ignored files, cancel the ignored POM file, and the parent project dependency will be automatically added!

Summary:

The root cause is that we have created modules with the same name before, but they are not really removed There is still a lot of information about deleting modules in the idea, so when creating a new module, the idea will automatically ignore the new module with the same name we wrote

Of course, a large part of the impact is because we use automatic skeleton generation!

[Solved] IDEA Start Maven Project Error: “Error starting ApplicationContext. To display the conditions report …”

When IDEA starts a maven project, it fails to start and displays an error reporting:

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
2021-12-22 09:21:42.183 ERROR 14964 — [           main] o.s.b.d.LoggingFailureAnalysisReporter   :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class

Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (the profiles local are currently active).

Cause:
The datasource related package environment is referenced, but no related configuration is performed

Solution:
1, start the class to add automatic configuration parameters: (exclude = {DataSourceAutoConfiguration.class})

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class ApiserviceApplication {

    public static void main(final String[] args) {
        SpringApplication.run(ApiserviceApplication.class, args);
    }
}

2. If the code does not use the relevant package environment, the relevant Maven package can be deleted

<!--        <dependency>-->
<!--            <groupId>org.springframework.boot</groupId>-->
<!--            <artifactId>spring-boot-starter-data-cassandra-jpa</artifactId>-->
<!--        </dependency>-->

3. If used, add relevant configurations

[Solved] Springcloud Add Eureka to Startup Error

1.Error Messages:
Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:
    java.lang.invoke.MethodHandleNatives.resolve(Native Method)
The following method did not exist:
    com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;
The method's class, com.google.gson.GsonBuilder, is available from the following locations:
    jar:file:/E:/smallTools/maven/rep/com/google/code/gson/gson/2.1/gson-2.1.jar!/com/google/gson/GsonBuilder.class
The class hierarchy was loaded from the following locations:
    com.google.gson.GsonBuilder: file:/E:/smallTools/maven/rep/com/google/code/gson/gson/2.1/gson-2.1.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.google.gson.GsonBuilder
Process finished with exit code 1

2. Solution

Add gson dependency

<dependency>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson</artifactId>
    <version>2.6</version>
</dependency>

[Solved] tomcat Startup Error: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes

Error: invalid signature file digest for manifest main attributes

The project runs normally on the local machine, but it cannot be started when deployed to the Tomcat of the server. The following error is reported:

Caused by: java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
        at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:239) [:1.6.0_30]
        at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:193) [:1.6.0_30]
        at java.util.jar.JarVerifier.processEntry(JarVerifier.java:296) [:1.6.0_30]
        at java.util.jar.JarVerifier.update(JarVerifier.java:207) [:1.6.0_30]
        at java.util.jar.JarFile.initializeVerifier(JarFile.java:342) [:1.6.0_30]
        at java.util.jar.JarFile.getInputStream(JarFile.java:410) [:1.6.0_30]
        at org.jboss.vfs.spi.JavaZipFileSystem.getFile(JavaZipFileSystem.java:159) [jboss-vfs.jar:3.0.0.GA]
        at org.jboss.vfs.VirtualFile.getPhysicalFile(VirtualFile.java:262) [jboss-vfs.jar:3.0.0.GA]
        at org.jboss.web.deployers.AbstractWarDeployer$1.visit(AbstractWarDeployer.java:853) [:6.0.0.Final]
        at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:408) [jboss-vfs.jar:3.0.0.GA]
        at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]
        at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]
        at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]
        at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:396) [jboss-vfs.jar:3.0.0.GA]
        at org.jboss.web.deployers.AbstractWarDeployer.getExplodedWarUrl(AbstractWarDeployer.java:866) [:6.0.0.Final]
        at org.jboss.web.deployers.AbstractWarDeployer.deploy(AbstractWarDeployer.java:400) [:6.0.0.Final]
        ... 47 more

Almost all the Internet queries have problems. There are files in the meta-inf folder of the packaged jar or war.JBoss is trying to process these files or doesn’t want to process them there.

However, I found that my meta-inf folder was empty and there was no * RSA,*.DSA,*.SF and other documents are hard to understand
I have also tried to repackage and replace the Tomcat version, but this problem has not been solved.

Finally, I thought that the project is divided into modules. Are there these files in the jar package generated by the referenced submodule? Finally, I checked one by one and finally found the problem:
there are these * RSA,*. DSA,*. SF files

remove these files from the jar package:

zip -d <jar file name>.jar META-INF/*.RSA META-INF/*.DSA META-INF/*.SF

But this is a temporary solution but not a permanent solution. The problem will still occur in the next packaging. Finally, go to the pom.xml file to exclude META-INF/*.SF and other files

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-shade-plugin</artifactId>
	<version>3.1.1</version>
	<executions>
		<execution>
			<phase>package</phase>
			<goals>
				<goal>shade</goal>
			</goals>
			<configuration>
				<filters>
					<filter>
						<artifact>*:*</artifact>
						<excludes>
							<!-- Exclude the following files to prevent verification errors when the program is started  -->
							<exclude>META-INF/*.SF</exclude>
							<exclude>META-INF/*.DSA</exclude>
							<exclude>META-INF/*.RSA</exclude>
						</excludes>
					</filter>
				</filters>
			</configuration>
		</execution>
	</executions>
</plugin>

[Solved] Maven compile error: Blocked mirror for repositories

1. The following error is reported when compiling with Maven. The developer uses the same setting locally XML file compilation is OK

Could not resolve dependencies for project
Could not transfer artifact
Blocked mirror for repositories

2. The solution is to find the data because it is found in 3.8.1. In later versions, all HTTP protocol repositories are lost in the block, which can be solved by setting the values of mirror of and blocked attributes in the mirror to false. In consideration of setting XML is a general-purpose file, so we do not intend to modify it, but reduce the Maven version to 3.6 three

3. After reducing the version, rebuild and solve the problem

[Solved] spring boot integrated PageHelper Error

The error reporting information is as follows:

 Error creating bean with name 

'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration'

Description:

The dependencies of some of the beans in the application context form a cycle:

┌──->──┐
|  com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
└──<-──┘

└──<-──┘

The spring boot version is 2.6.1

<parent>
   <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>2.6.1</version>
   <relativePath/> <!-- lookup parent from repository -->
</parent>

The page helper version is 1.2.3

<!-- pageHelper -->
<dependency>
   <groupId>com.github.pagehelper</groupId>
   <artifactId>pagehelper-spring-boot-starter</artifactId>
   <version>1.2.3</version>
</dependency>

After verification by many parties, it is found that the error is due to the conflict between the springboot version and the PageHelper version.

Solution:

    1. reduce the springboot version, such as 2.5 3 (the PageHelper version remains unchanged from 1.2.3)
<parent>
   <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-parent</artifactId>
     <version>2.5.3</version>
   <relativePath/> <!-- lookup parent from repository -->
</parent>

Increase the version of PageHelper, such as 1.4 1 (the springboot version remains unchanged from 2.6.1)

<!-- pageHelper -->
<dependency>
   <groupId>com.github.pagehelper</groupId>
   <artifactId>pagehelper-spring-boot-starter</artifactId>
   <version>1.4.1</version>
</dependency>

I hope my solution will help you a little. Good luck!!!

How to Solve Swagger error: IllegalStateException

Swagger reported an error, IllegalStateException

I encountered a novel mistake today. Take a note.

Because of the project problem, I imported the swagger dependency into the common module. Then, because common is introduced into the gateway, check the dependency tree and confirm that the gateway also introduces the swagger dependency by default.

Due to the introduction of a problem, an error is reported when starting the gateway. The error is as follows:

java.lang.IllegalStateException: Failed to introspect Class [com.tang.config.SwaggerConfiguration] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:481)
	at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:358)
	at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:414)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
Caused by: java.lang.NoClassDefFoundError: springfox/documentation/spring/web/plugins/Docket
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.getDeclaredMethods(Class.java:1975)
	at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:463)
	... 33 common frames omitted
Caused by: java.lang.ClassNotFoundException: springfox.documentation.spring.web.plugins.Docket
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 37 common frames omitted

Because the error occurred after the swagger dependency was introduced. So I preliminarily determined that the error occurred in the two swagger dependencies I imported.

        <!-- swagger -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
        </dependency>

After querying the boss on stackoverflow, the answer is that swagger needs web dependency when it is started. If it does not exist, an error will be reported. I tried to add and found

A respectful error is reported on the console:

**********************************************************

Spring MVC found on classpath, which is incompatible with Spring Cloud Gateway at this time. Please remove spring-boot-starter-web dependency.

**********************************************************

Because it was an error found in the gateway. Therefore, it is obvious that the spring cloud gateway integrates weblux and thus the web. Therefore, adding spring-boot-starter-web to the project will cause the above error.

<dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-gateway-server</artifactId>
      <version>2.2.7.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-webflux</artifactId>
      <version>2.3.8.RELEASE</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.cloud</groupId>
      <artifactId>spring-cloud-starter-loadbalancer</artifactId>
      <version>2.2.7.RELEASE</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>

Solution:

Because the gateway in the project does not need to integrate swagger, when introducing the basic module package with swagger in the gateway configuration, it only needs to be in POM XML settings <exclusions></exclusions>

<exclusions>
    <exclusion>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
    </exclusion>
    <exclusion>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
    </exclusion>
</exclusions>

Finally, because the related configuration classes of swagger are also written in the basic module. An error will also be reported because the swagger dependency is not imported. At this time, you only need to ignore the injection in the gateway gateway startup class.

@ComponentScan(excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = SwaggerConfiguration.class))

[Solved] mybatis Error: Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.

java.lang.ExceptionInInitializerError
	at com.example.dao.UserDaoTest.test(UserDaoTest.java:12)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.apache.ibatis.exceptions.PersistenceException: 
### Error building SqlSession.
### Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 18; 1 字节的 UTF-8 序列的字节 1 无效。
	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:80)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:64)
	at com.example.util.MybatisUtils.<clinit>(MybatisUtils.java:19)
	... 26 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 18; 1 字节的 UTF-8 序列的字节 1 无效。
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:263)
	at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:127)
	at org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:81)
	at org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:77)
	... 28 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 18; 1 字节的 UTF-8 序列的字节 1 无效。
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204)
	at java.xml/com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:178)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1000)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
	at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:261)
	... 31 more
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 1 字节的 UTF-8 序列的字节 1 无效。
	at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:702)
	at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:568)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1904)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(XMLEntityScanner.java:1377)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(XMLScanner.java:800)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(XMLDocumentFragmentScannerImpl.java:1069)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:883)
	... 39 more

Solution:

Change UTF-8 in the XML of all configuration files to utf8

After modification, you can query it.

[Solved] Maven Package Error: Error assembling JAR

Cause of the problem
the jar package prompted is occupied by other programs, so it is impossible to repackage and replace the old package

Solution:
1. If the jar package can be run, check whether the jar package is running and end the corresponding process
2. Check whether the read-write permission of the jar package has been changed and give the file read-write permission before operation
3. Check whether other software is editing the jar package file (such as compression software) and exit editing

[Solved] ssm Error: Error creating bean with name ‘employeeController’: Injection of autowired dependencies failed

08-Dec-2021 12:08:06.572 Warning [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.servlet.DispatcherServlet.initServletBean Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘employeeController’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.lyq.ssm.service.EmployeeService com.lyq.ssm.controller.EmployeeController.employeeService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘employeeService’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.lyq.ssm.dao.EmployeeMapper com.lyq.ssm.service.EmployeeService.employeeMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.lyq.ssm.dao.EmployeeMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)

1.Scanning whether the annotation is open
Opened

<context:component-scan base-package="com.lyq.ssm">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"></context:exclude-filter>
</context:component-scan>

2. Whether spring listener is configured
if it is not configured:

    <!--Configure spring's listener to load only the files in the WEB-INFO directory by default-->
<listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

After the configuration is completed, it runs successfully