I'm new to spring boot and have an error so basic, I clearly have an obvious error. But I've RTM'ed and the docs and am missing a point:

**tl/dr**

how can I use @Value annotation to get values from the "spring environment"?

**Context**

I seek to:

* pass 'jdbc info' (e.g., url/password/login) to the application/"spring environment" using environment variable SPRING\_APPLICATION\_JSON
* use this jdbc info in the application 'post process context' to set the url/creds/etc for jdbc jndi

**Problem**

* I have set environment variable SPRING\_APPLICATION\_JSON, but spring boot does not appear to "pick it up"

**Example Calling program**

Both of these fail:

```
SPRING_APPLICATION_JSON='{"spring": {"datasource": { "url":"jdbc:mysql://localhost:3306/myapp", "username":"myappuser", "password":"mypassword" } } }' java -jar build/libs/myapp_springboot.war  

```

and

```
-Dspring.application.json='{"spring": {"datasource": { "url":"jdbc:mysql://localhost:3306/myapp", "username":"myappuser", "password":"mypassword" } } }' java -jar build/libs/myapp_springboot.war  

```

**Example Usage** 

Here's the class that tries to access:

```
@Component
public class DbInfo
{  
   @Value("${spring.datasource.url}")
   String fUrl;

```

Note that I didn't have any "PropertySource stuff". I initially thought that I would get that for free.

**Error**

> 
> Could not resolve placeholder 'spring.datasource.url' in string value
>  "${spring.datasource.url}"
> 
> 
> 

**Also Tried this**

I have tried this:

```
@Configuration
@PropertySource({
        "classpath:application.properties",
})
public class MyDbInfo
{

   @Autowired
   Environment fEnvironment;

```

**Environment**

```
springBootVersion = '1.4.2.RELEASE'

```

**Reference**

<https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-vs-value>

Thanks in advance