I have the following:
@Service(DropboxService.NAME)
public class DropboxServiceBean implements DropboxService {
@Inject
private CustomConfig customConfig;
private final String ACCESS_TOKEN = customConfig.getDropboxAppToken();
DbxRequestConfig config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
DbxClientV2 client = new DbxClientV2(config, ACCESS_TOKEN);
Does anyone know how I can get the values of the customConfig.getDropboxAppToken();
to load first. I keep getting the following error:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'myApp_DropboxService' defined in URL
[jar:file:/E:/Cuba/myApp/deploy/tomcat/webapps/app-core/WEB-INF/lib/app-core-0.1-SNAPSHOT.jar!/com/daryn/myApp/service/DropboxServiceBean.class]:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.daryn.myapp.service.DropboxServiceBean]: Constructor
threw exception; nested exception is java.lang.NullPointerException
Current code I am trying
ERROR: Error creating bean with name 'ecosmart_BackupService': Unsatisfied dependency expressed through field 'dropboxService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ecosmart_DropboxService': Invocation of init method failed; nested exception is java.lang.NullPointerException
@Service(DropboxService.NAME)
public class DropboxServiceBean implements DropboxService {
@Inject
private CustomConfig customConfig;
private String ACCESS_TOKEN = "";
DbxRequestConfig config;
DbxClientV2 client;
@PostConstruct
public void postConstruct() {
System.out.println("**************Running post construct");
ACCESS_TOKEN = customConfig.getDropboxAppToken();
config = new DbxRequestConfig("dropbox/java-tutorial", "en_US");
client = new DbxClientV2(config, ACCESS_TOKEN);
}