Tag Archives: commonerror

cvc-complex-type.2.3: Element ‘beans’ cannot have character [children]

When writing Spring’s ApplicationContext.xml file, out of nowhere:
CVC-Complex Type.2.3: Element ‘beans’ cannot have character [children], because the type’s content type is element-only. Error.

Error: Spring does not recognize the elements in ApplicationContext.xml when initialized.
Possible reasons for this error: The code copied online is pasted directly into an XML file, and the code on the Web may not conform to the XML specification

Remove the Chinese annotations from the XML file, because some of the annotations copied are not recognized by Spring.  
2. If there is still an error, try to modify the extra space, because Chinese space Spring may recognize the error.
3. Last resort: Copy the file again manually and save it.