'How do I resolve “Element bean is not allowed here” when configuring the XML file?

I was creating a simple Java project by importing 4 major jar packages of Spring(beans, core, context and expression, all are ver 5.2.6). However, IDEA kept indicating that "element bean is not allowed here" even though I checked repeatedly that the dependencies are placed correctly in the module section and restarted the IDE. The configuration is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!--Creating User Object-->
    <bean id = "user" class = "com.zhouss.User"><bean/> #bean is where it reports error
</beans> 

And here's a snapshot of the dependency jars: dependency jars configured updated project info

I'm a complete newbie on Spring, how do I resolve the issue?



Solution 1:[1]

As it turned out, it was a problem with the particular version of IDEA (2020.3, mac), I have updated to the latest version of 2022.1, mac and the error simply disappears by themselves.

I found very little info online when I tried to resolve this problem, so I find it necessary to write down my findings.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 dfgfgg