Results 1 to 5 of 5

Thread: Spring Validation and Constructors

Hybrid View

  1. #1
    Join Date
    Apr 2008
    Posts
    151

    Default Spring Validation and Constructors

    I noticed that a recent checkout of the Spring PetClinic Samples application has an error in STS, specifically it complains in the Spring validation on line 72 of applicationContext-hibernate.xml that clinic bean, of type org.springframework.samples.petclniic.hibernate.Hi bernateClinic does not have a constructor with 0 arguments. In fact, that file has no constructors. Amazingly enough, STS will 'quick fix' this and add a stub constructor that removes the error and allows the project to run without problems.

    I haven't noticed on prior versions of STS -- perhaps the Validator logic doesn't think java.lang.Objecte's empty constructor counts?

    Platform is Ubuntu 9.10, Java 1.6.0_16-b01, STS 2.3.0.RELEASE, check out of petclinic as of 1am 12-30-09.

  2. #2
    Join Date
    Aug 2004
    Location
    Duesseldorf, Germany
    Posts
    1,210

    Default

    Jabberz,

    In order to make sure I'll use the same PetClinic as you, can you post the SVN URL you are using to generate this issue?

    Thanks in advance.

    Christian
    Christian Dupuis
    SpringSource, a division of VMware
    Lead, SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/cdupuis

  3. #3
    Join Date
    Apr 2008
    Posts
    151

    Default

    The URL is:

    https://src.springframework.org/svn/...etclinic/trunk

    The version of the file is 175, last updated by 'cleau' on Wed Nov 25 13:45:52 EST 2009.

  4. #4
    Join Date
    Aug 2004
    Location
    Duesseldorf, Germany
    Posts
    1,210

    Default

    Thanks for providing the details.

    You are seeing the same error as reported in the following JIRA:

    IDE-1042: @Autowired-constructor not recognized correctly
    http://jira.springframework.org/browse/IDE-1042

    In my version of petclinic the HibernateClinic implementation has the following constructor:
    Code:
    @Autowired
    public HibernateClinic(SessionFactory sessionFactory) {
    	this.sessionFactory = sessionFactory;
    }
    This constructor is not detected by the validation logic.

    Christian
    Christian Dupuis
    SpringSource, a division of VMware
    Lead, SpringSource Tools Team
    http://www.springsource.com
    http://twitter.com/cdupuis

  5. #5
    Join Date
    Apr 2008
    Posts
    151

    Default

    Ah for some reason missed seeing that constructor while I was paging through the file. Nevertheless, the spring valdiator misses it on mine as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •