Results 1 to 5 of 5

Thread: Optional @ExternalValue's

  1. #1

    Default Optional @ExternalValue's

    It would be nice if an @ExternalValue didn't exist, one could mark the annotation as being optional, and it would set the field to null, instead of throwing an exception if it didn't exist.

    For example, in our application, I would like it to be optional to set the following c3p0 database pooling properties

    * maxConnectionAge
    * maxIdleTime
    * maxIdleTimeExcessConnections

    So if we don't see them in the properties file, the field would be null.

    Right now, we need to list the property in the file with an empty value, which makes the file a little longer.

    This is more of a nice to have feature.

    However, this could be a way of distinguishing between non-existent settings and a setting value with an empty string.

  2. #2
    Join Date
    Apr 2007
    Posts
    307

    Default

    As you may be aware, JavaConfig functionality is moving into Spring core for the 3.0 release. As part of that move, @ExternalValue has been replaced by the much more powerful combination of @Value and Spring Expression Language (EL).

    I would recommend taking a look at the nightly snapshots for 3.0, or give the 3.0 M3 milestone release a spin as soon as it drops. Try out @Value, and please do provide feedback. There are interesting implications around behavior when expressions do not resolve, and we'd like to get user input on that.

    In the meantime, of course, you can continue to use JavaConfig milestones to good effect. Please keep in mind,however, that @ExternalValue won't be supported any longer and you'll eventually need to switch.
    Chris Beams
    Spring Framework committer, VMware
    http://github.com/cbeams

  3. #3

    Default

    Thanks Chris, I'll check out M3. How soon is it going to be released? It sounds like it'll be out any day for the last few weeks

  4. #4
    Join Date
    Jun 2009
    Posts
    1

    Default

    Just checking if this has been released yet? As I'd love to grab it when it is =)

  5. #5
    Join Date
    Apr 2007
    Posts
    307

    Default

    Chris Beams
    Spring Framework committer, VMware
    http://github.com/cbeams

Posting Permissions

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