I have a spring-boot project which serves angularjs. Both the front-end and back-end code are in the same project.
In my angularjs service.js files I am calling the back-end service. I have different urls in the different properties file. I want to read them as per profile selection. I know how to read properties file in a Java class but I am not sure how to read values from properties file in a javascript file.
As shown below:
Some options:
create a separate config.json for your angular APP (manage it manually).
use maven resource plugin to filter placeholders for your config.json file (automated). Eg read in one place and substitute in another (but I don't like this way).
Or create an API to return data from from your properties file as JSON. https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.