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!
Read More:
- [Solved] Rabbitmq injection failed, bean creation failed, error creating bean with name ‘rabbitconnectionfactory’‘
- Error creating bean with name ‘adminMapper‘ Injection of resource dependencies failed
- [Solved] BeanCreationException: Error creating bean with name ‘configurationPropertiesBeans‘
- [Solved] ssm Error: Error creating bean with name ‘employeeController’: Injection of autowired dependencies failed
- SpringCloud: Error creating bean with name ‘configurationPropertiesBeans‘
- [Solved] Error creating bean with name ‘org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0‘:
- Error creating bean with name [How to Solve]
- [Solved] Spring AOP Error creating bean with name
- [Solved] Error creating bean with name ‘accountService‘: Unsatisfied dependency expressed through field
- [Solved] BeanCreationNotAllowedException:Error creating bean with name ‘rabbitConnectionFactory‘:
- [Solved] Error creating bean with name ‘fileVisitController‘ defined in file
- [Solved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xxx‘
- [Siolved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘webMvcObject
- [Solved] Error creating bean with name ‘redisConnectionFactory‘ defined in class path resource…
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘testApplicat
- [Solved] Error creating bean with name ‘mappingJackson2HttpMessageConverter‘ defined in class path resource
- Error creating bean with name ‘servletEndpointRegistrar‘ defined in class path resource
- [Solved] Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource
- [Solved] Arthas failed to bind telnet or http port! Telnet port: 3658, http port: 8563;Error creating bean
- springboot Integrate mybatis Error: Error creating bean with name ‘deptController‘: Unsatisfied dependency expresse