0

I have a dataSource bean. I need to extract a boolean value from it:

dataSource.getConnection().getMetaData().supportsStoredProcedures()

and then use it inside my DAO to define behavior.

The obvious way to get this value is to inject dataSource directly to my DAO class (currently it uses only EntityManager). But I'm curious is there a way to get only boolean flag value?

Can we use spring expression language inside @Value annotation to calculate the flag? Or is there any other alternative?

Roman
  • 64,384
  • 92
  • 238
  • 332

1 Answers1

0

Something like This?

[Spring XML]

    <util:properties id="myProps" location="classpath:com/acme/app/myprops.properties"/>

[Java]

    @Value("#{myProps.hostname}")
    public void setHostName(String hostname) {
        this.hostname = hostname;
    }

Source: http://forum.springsource.org/showthread.php?69602-Value-and-PropertyPlaceholderConfigurer

Bob Flannigon
  • 1,204
  • 9
  • 8