ゼロからSpring Boot 2.x【3】SprigBootを全面的に認識するアプリ.properties

3767 ワード

Spring Bootはプロファイルのaplication.yml/appication.propertiesを通じて、ほとんどのコンポーネントに対するコントロールと構成を完成することができます.だから、Spring Bootを素早く使うために、すべての構成項目についての概観が必要です.ここではいくつかの説明と翻訳を行います.その中で一番完璧な配置資料は参考してください.
https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html
公式の設定文書
以下にいくつかの私の個人的な感覚は、より一般的な構成を示します.
1、bannerの配置
       banner.chaset=UTF-8
      banner.location=claspath:banner.txt 
2、profilesの配置
      spring.profiles.active=現在アクティブにしているpeofficeの配置、例えば:devを記入するとSpringbootが起動する時、自動的にappication-dev.propertiesを探して、配置ファイルとして起動します.
 
3、Apple Settings
     spring.main.web-enviromenet
     spring.main.show-banner=true //ブートバナーを展示するかどうか
 
4、ログログ関連
    loging.path=/var/logs
    loging.file=myap.logs
    loging.co nfig=プロファイル(デフォルト:クラスパス:logback.xml)
   loging.level.*=. //パッケージのログ印刷レベルを設定し、複数の項目を設定できます.
 
5、spring.appication.name=アプリケーションid
 
6、Springに埋め込まれたサーバ構成
   server.port=8080
  server.address=一つのIPをバインドする
  server.session-timeout=36000セッションが失効しました.
  server.co ntenxt-path=/ アクセスパス
  server.tomcat.max-threads=0 
  server.tomcat.uir-encoding=UTF-8
  7、Spring MVCの配置
  spring.mvc.locale= 
spring.mvc.date-format=日付フォーマット:dd/MM/yy
spring.view.prefix= 
spring.view.suffix = 
 
8、ファイルアップロードの設定
multiiprt.enabled=true 
multiipad.file-size-thress hold=0 ファイルサイズのしきい値、0は制限しないことを示します.
multiiprt.location=ファイルをアップロードする位置
multiiprt.max-file-size=  アップロードファイルの最大位置
multiiprt.max-request-size=10 M 最大要求サイズ
 
9、http encoding
スプリング、http.encoding.chaset=UTF-8
spring.http.encoding.enable=true 
spring.http.encoding.force=true
 
10、Spring Securityspring.security.user.nameuserデフォルトのユーザ名spring.security.user.password 
デフォルトのパスワードは、設定しないと起動時にランダムに生成して印刷します.spring.security.user.roles 
上のアカウントに対応するキャラクター権限を付与します.
  pring.session.store-type標準キャッシュ
Session記憶タイプspring.session.timeout 
セッション有効期限
 
11、JPAの配置についてring.jpa.database 
Target database to ope rate on,aut-detected by default.Can be alternal ively set using the「databasePlatform」property.spring.jpa.database-platform 
Name of the tatabase to operate on,aut-detected by default.Can be alternative ely set using the「Database」enum.spring.jpa.generate-ddlfalseWhether to initialize the schema on startup.spring.jpa.hibernate.ddl-auto 
DDL mode.This is actually a shartcut for the「hibernate.hbm 2 ddl.aut」property.Defaults「create-drop」when using an embedded database and no schemamama manager wats dected.Otherwise,dected.Otherwise,ders,defaultsspring.jpa.hibernate.naming.implicit-strategy 
Fully qualified name of the implicit naming strate.spring.jpa.hibernate.naming.physical-strategy 
Fullyqualifed name of the physical naming strate.spring.jpa.hibernate.use-new-id-generator-mappings 
Whether to use Hbernate's newer Identifer Generator for AUTO,TABLE and SEQUICE.This is actually a shot for the「hibernation.id.newuberger appings」property.When not specifelt deull.wint.spring.jpa.mapping-resources 
Mapping resource(equivalent to"mapping-file"entries in persistence.xml)spring.jpa.open-in-viewtrueRegister OpenEntintityManager InView Intercepter.Binds a JPA EnttityManager to the thread for the ntire processing of the request.spring.jpa.properties.* 
Additional native properties to set on the JPA provider.spring.jpa.show-sqlfalseSQLを展示していますか