ファイル:
application.properties春ブートプロパティは、私は現在、3つのプロパティファイル持って外在
[email protected]@
application-develoment.properties
#DB properties:
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost:5432/mydb
db.username=user
db.password=pswd
#Data source management:
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql=true
hibernate.current_session_context_class=thread
application-production.propertiesを
#DB properties:
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost:5432/myproddb
db.username=admin
db.password=admin
#Data source management:
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql=false
hibernate.current_session_context_class=thread
私は私ののpom.xml
<profiles>
<profile>
<id>development</id>
<properties>
<activatedProperties>development</activatedProperties>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>production</id>
<properties>
<activatedProperties>production</activatedProperties>
</properties>
</profile>
</profiles>
と私のDataSourceConfigの中で次のように私のMavenのプロファイルが設定されている:annotaion @PropertySource(値は= "クラスパス:application.properties")
開発やプロダクションプロファイルでコンパイルするとすべてうまく動作しますが、プロパティファイルをTomcatサーバーの/ conf/localhostディレクトリに外部化したいと思います。
.jarが配置されている場所にapplication - *。propertiesファイルを置くだけです。 –