Skip to content

XML bean singleton attribute silently ignored [SPR-12167] #16781

Closed

Description

@spring-projects-issues

Alexander Kudrevatykh opened SPR-12167 and commented

In commit 2c3a8a5 support of singleton attribute was dropped
Now if xml contains that attribute it silently ignored, that can cause unexpected behavior in runtime.
I think spring should throw exception in case of such unsupported attributes.


Affects: 4.0.6

Issue Links:

Backported to: 4.0.8

Activity

  1. spring-projects-issues commented on Sep 9, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    Note that as of Spring 4.0, we dropped support for pre-2.0 DTDs entirely. And with any 2.0+ DTDs/XSDs, you don't have the 'singleton' attribute declared anymore. Are you still using an older DTD there, or did you turn off XML validation?

    In any case, we can certainly throw a proper exception in such a case.

    Juergen

  2. spring-projects-issues commented on Sep 10, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Alexander Kudrevatykh commented

    I know that support was dropped, and after migration to 2.0+ DTD/XSD validation error throwed on this attribute.
    Validation is turned on, but old DTD used

    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    

    It would be nice if any exception thrown when using such old DTDs.

  3. spring-projects-issues commented on Sep 17, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    If we choose to do something 'soft' such as log a warning, we can backport this to 4.0.8 as well.

    Juergen

  4. spring-projects-issues commented on Sep 17, 2014

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    When encountering the 'singleton' attribute, we are raising a parse error (turned into an exception) as of Spring Framework 4.1.1 now.

    For 4.0.8, we'll just raise a parse warning since quite a few apps might work fine even with some old definition files in use, and we don't want to disrupt them that late in the branch.

    Juergen

  5. added
    status: backported
    type: enhancement
    in: core
    on Jan 11, 2019
  6. added this to the 4.1.1 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: corestatus: backportedtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions