My environment variables are managed via spring profile and i have an xml that contains the entry below...
<context:property-placeholder location="classpath:/properties/app_config_${spring.profiles.active:dev}.properties" />
In the file app_config_dev.properties file, i have the entry below: otherApp.baseurl=devEnvt.mainApp.com.au
In the backend, i have a Service object and the variable is annotated by @Value to take advantage of spring taking care of getting the value via the property file in which the application is deployed in (can be dev, staging or prod).
@Service
@Slf4j
public class AppService {
@Value("${otherApp.baseurl:https://test..}")
private String baseUrl;
}
In the front end, i have this index.jsp that basically just redirects to a url.
<%
Account acc = Account.getAccount(session);
String url = request.getScheme() + "://" + "url_value_from_environment_aware_property_file" + "/reset";//url_value_from_environment_aware_property_file should be equal to otherApp.baseurl
if (acc != null){
JSPUtil.contentInclude(pageContext, "error_loggedin.jsp");
}else{
response.sendRedirect(url);
}
%>
My question is, given that I have a very basic jsp here, how can I access the environment aware variable that is being managed by Spring?