mercredi 6 septembre 2017

@RequestMapping on Class, set Value from @Configuration

I have a endpoint using @RequestMapping(), but currently it just contains a hardcoded String as the path. Is there someway to do that in a configureable way. Currently we use a @Configuration which sources different propertySources.

Example of endpoint(as it is now)

@RestController
@RequestMapping("endpoint-path")
public class Endpoint {....}

Example how Config class is

@Configuration
@PropertySource("....")
@ConfigurationProperties
@Validated
public class EndpointConfiguration {...}

Just mentioning that I dont just want to reference the propertyfile, I want to reference the property class. Not as below

@RestController
@RequestMapping("${endpoint.path}")
public class Endpoint {....}




Aucun commentaire:

Enregistrer un commentaire