0

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?

7
  • Change to <bean id = "user" class = "com.zhouss.User"></bean> Commented May 1, 2022 at 6:02
  • Tried that, still reported the same error. I am guessing it's still because the spring jar dependencies are somewhat not configured right, for there is no suggested messages prompted when typing "bean". Commented May 1, 2022 at 8:19
  • Show all your code. Do you use maven? Did you create class User? Commented May 1, 2022 at 8:28
  • Updated, the User class I created is left empty, and so are other classes. Commented May 1, 2022 at 8:34
  • No, did not use maven. Just created a java project. Commented May 1, 2022 at 8:35

1 Answer 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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.