I have two classes which both use configuration properties.
This one loads
package com.cegeka.campus;
@RestController
@RequestMapping("api/outlook")
public class OutlookController
{
@Value("${frontend.url}")
private String frontendUrl;
.....
}
But this one returns null:
package com.cegeka.campus;
public class AuthHelper
{
@Value("${backend.authorize.url}")
private static String redirectUrl;
...
}
Our main class looks like this:
@SpringBootApplication
@ComponentScan("com.cegeka.campus")
@EnableJpaRepositories("com.cegeka.campus")
@EntityScan("com.cegeka.campus")
public class CampusApplication extends SpringBootServletInitializer
{
public static void main(String[] args)
{
SpringApplication.run(CampusApplication.class, args);
}
}
Why can't I load backend.authorize.url? The @Value simply doesn't inject.
The properties file (application.yml) looks like this:
frontend:
url: http://hi02549:8080/courseka
backend:
authorize:
url: http://hi02549:8080/campus/api/outlook/authorize