Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: How to read from

Gal Sosin:

I'm trying to read from and I can't get it working.

this is my code:

package config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;

public class ApplicationService {

private Environment env;

public String readProperty(String key) {
return env.getProperty(key);


When I run this code, the env instance is null. My file is located in the resource folder. I'm out of ideas, please help.

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: How to read from


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription