2016-07-27 26 views
0

Gibt es eine Möglichkeit, in die @Path-Annotation eine Zeichenfolge aus der yaml-Konfigurationsdatei zu injizieren, die zum Ausführen des Dropwizard-Dienstes verwendet wird?Dropwizard/Jersey - Servicedomäne aus Konfigurationsdatei

Ich kann nichts über die guide finden. Dank

Beispiel:

Config-Datei:

server: 
    applicationConnectors: 
    - type: http 
    port: 5555 
    adminConnectors: 
    - type: http 
    port: 5556 
my-service-domain: /my-service 

Ressource:

@Path("#{my-config.my-service-domain}") 
@Produces({"application/json"}) 
public class MyResource { 
... 
} 
+0

Sie könnten etwas tun wie [dies] (http://stackoverflow.com/a/34990765/2587435) –

Antwort

0

Für Dropwizard 0.8.0 und neuere dies aus dieser Konfiguration erreicht:

applicationContextPath:/
rootPath: /application 

Dabei steht ApplicationContextPath für den Kontextpfad von Jetty und rootPath für Jersey.