java - Spring Best approach for multiple environments -



java - Spring Best approach for multiple environments -

i have following:

system - authorization (rest api) system b - needs check auth system c - needs check auth system d - needs check auth

and have many environment:

development homolog production

each 1 have different urls system a. want create project integrate systems. since systems utilize bailiwick of jersey , spring, can create 1 filter (jersey) abort request in case user not authorized.

so thought create integration system jar jerseys filters , uses parents configuration (active profile spring) right url. might utilize jar create system b communicate system d also, if can create work.

the trick is, making jar right .properties file based on enviroment (set on parent-project). honest, dont know begin.

reading docs spring environment found:

do not utilize profiles if simpler approach can job done. if thing changing between profiles value of properties, spring's existing propertyplaceholderconfigurer / may need.

i have 3 different properties files (development, homolog or production) or have 1 properties file different keys:

system.a.url.develpment=http://localhost:8080/systema/authorize system.a.url.homolog=http://localhost:8081/systema/authorize system.a.url.production=http://api.systema.com/authorize

what best approach? do?

in such "simple" case utilize property file configuration of urls , have different config files different environments (dev, prod,..) 1 (same named property), e.g.

system.a.url=http://localhost:8081/systema/authorize

you can manage property files manually (e.g. outside jar/war) or can utilize maven profiles create jar/war file specific environment. don't see need spring profiles.

edit: alternatively can utilize environment variables "configure" settings specific environment (what coincidence in names :)). note can have different environments within 1 machine. more details check e.g. this.

export auth_url="http://localhost:8081/systema/authorize"

java spring environment spring-environment

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -