Link to home
Start Free TrialLog in
Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on

Instantiating a class without constructor and with @Value annotation for Junit

Hi,
I want to make a Bean in context of my Junit code of a spring web application. Here is the class in the project that i want to instantiate.
This has no constructor and also uses @Value annotation. How to do it.

@Service
public class AppEnvironment {

    @Value("${app.appId}")
    private String appId;
    @Value("${app.appSecret}")
    private String appSecret;
    @Value("${app.isProd}")
    private boolean isProd;
    @Value("${app.baseUrl}")
    private String baseUrl;
    @Value("${app.botId}")
    private String botGUID;
    @Value("${app.botToken}")
    private String botToken;
    @Value("${app.iconUrl}")
    private String appIconUrl;
    private String fontColor;
    @Value("${app.notificationHostname}")
    private String reminderBotHost;

Open in new window


Thanks
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This is a perfectly valid answer.