spring boot application properties配置实例代码详解
废话不多说了,直接给大家贴代码了,具体代码如下所示:
#=================================================================== #COMMONSPRINGBOOTPROPERTIES # #Thissamplefileisprovidedasaguideline.DoNOTcopyitinits #entiretytoyourownapplication.^^^ #=================================================================== #---------------------------------------- #COREPROPERTIES #---------------------------------------- #SPRINGCONFIG(ConfigFileApplicationListener) spring.config.name=#configfilename(defaultto'application') spring.config.location=#locationofconfigfile #PROFILES spring.profiles=#commalistofactiveprofiles #APPLICATIONSETTINGS(SpringApplication) spring.main.sources= spring.main.web-environment=#detectbydefault spring.main.show-banner=true spring.main....=#seeclassforallproperties #LOGGING logging.path=/var/logs logging.file=myapp.log logging.config= #IDENTITY(ContextIdApplicationContextInitializer) spring.application.name= spring.application.index= #EMBEDDEDSERVERCONFIGURATION(ServerProperties) server.port=8080 server.address=#bindtoaspecificNIC server.session-timeout=#sessiontimeoutinseconds server.context-path=#thecontextpath,defaultsto'/' server.servlet-path=#theservletpath,defaultsto'/' server.tomcat.access-log-pattern=#logpatternoftheaccesslog server.tomcat.access-log-enabled=false#isaccessloggingenabled server.tomcat.protocol-header=x-forwarded-proto#sslforwardheaders server.tomcat.remote-ip-header=x-forwarded-for server.tomcat.basedir=/tmp#basedir(usuallynotneeded,defaultstotmp) server.tomcat.background-processor-delay=30;#inseconds server.tomcat.max-threads=0#numberofthreadsinprotocolhandler server.tomcat.uri-encoding=UTF-8#characterencodingtouseforURLdecoding #SPRINGMVC(HttpMapperProperties) http.mappers.json-pretty-print=false#prettyprintJSON http.mappers.json-sort-keys=false#sortkeys spring.mvc.locale=#setfixedlocale,e.g.en_UK spring.mvc.date-format=#setfixeddateformat,e.g.dd/MM/yyyy spring.mvc.message-codes-resolver-format=#PREFIX_ERROR_CODE/POSTFIX_ERROR_CODE spring.view.prefix=#MVCviewprefix spring.view.suffix=#...andsuffix spring.resources.cache-period=#cachetimeoutsinheaderssenttobrowser spring.resources.add-mappings=true#ifdefaultmappingsshouldbeadded #THYMELEAF(ThymeleafAutoConfiguration) spring.thymeleaf.prefix=classpath:/templates/ spring.thymeleaf.suffix=.html spring.thymeleaf.mode=HTML5 spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.content-type=text/html#;charset=isadded spring.thymeleaf.cache=true#settofalseforhotrefresh #FREEMARKER(FreeMarkerAutoConfiguration) spring.freemarker.allowRequestOverride=false spring.freemarker.allowSessionOverride=false spring.freemarker.cache=true spring.freemarker.checkTemplateLocation=true spring.freemarker.contentType=text/html spring.freemarker.exposeRequestAttributes=false spring.freemarker.exposeSessionAttributes=false spring.freemarker.exposeSpringMacroHelpers=false spring.freemarker.prefix= spring.freemarker.requestContextAttribute= spring.freemarker.settings.*= spring.freemarker.suffix=.ftl spring.freemarker.templateEncoding=UTF-8 spring.freemarker.templateLoaderPath=classpath:/templates/ spring.freemarker.viewNames=#whitelistofviewnamesthatcanberesolved #GROOVYTEMPLATES(GroovyTemplateAutoConfiguration) spring.groovy.template.allowRequestOverride=false spring.groovy.template.allowSessionOverride=false spring.groovy.template.cache=true spring.groovy.template.configuration.*=#SeeGroovy'sTemplateConfiguration spring.groovy.template.contentType=text/html spring.groovy.template.prefix=classpath:/templates/ spring.groovy.template.suffix=.tpl spring.groovy.template.templateEncoding=UTF-8 spring.groovy.template.viewNames=#whitelistofviewnamesthatcanberesolved #VELOCITYTEMPLATES(VelocityAutoConfiguration) spring.velocity.allowRequestOverride=false spring.velocity.allowSessionOverride=false spring.velocity.cache=true spring.velocity.checkTemplateLocation=true spring.velocity.contentType=text/html spring.velocity.dateToolAttribute= spring.velocity.exposeRequestAttributes=false spring.velocity.exposeSessionAttributes=false spring.velocity.exposeSpringMacroHelpers=false spring.velocity.numberToolAttribute= spring.velocity.prefix= spring.velocity.properties.*= spring.velocity.requestContextAttribute= spring.velocity.resourceLoaderPath=classpath:/templates/ spring.velocity.suffix=.vm spring.velocity.templateEncoding=UTF-8 spring.velocity.viewNames=#whitelistofviewnamesthatcanberesolved #INTERNATIONALIZATION(MessageSourceAutoConfiguration) spring.messages.basename=messages spring.messages.cacheSeconds=-1 spring.messages.encoding=UTF-8 #SECURITY(SecurityProperties) security.user.name=user#loginusername security.user.password=#loginpassword security.user.role=USER#roleassignedtotheuser security.require-ssl=false#advancedsettings... security.enable-csrf=false security.basic.enabled=true security.basic.realm=Spring security.basic.path=#/** security.headers.xss=false security.headers.cache=false security.headers.frame=false security.headers.contentType=false security.headers.hsts=all#none/domain/all security.sessions=stateless#always/never/if_required/stateless security.ignored=false #DATASOURCE(DataSourceAutoConfiguration&DataSourceProperties) spring.datasource.name=#nameofthedatasource spring.datasource.initialize=true#populateusingdata.sql spring.datasource.schema=#aschema(DDL)scriptresourcereference spring.datasource.data=#adata(DML)scriptresourcereference spring.datasource.platform=#theplatformtouseintheschemaresource(schema-${platform}.sql) spring.datasource.continueOnError=false#continueevenifcan'tbeinitialized spring.datasource.separator=;#statementseparatorinSQLinitializationscripts spring.datasource.driverClassName=#JDBCSettings... spring.datasource.url= spring.datasource.username= spring.datasource.password= spring.datasource.max-active=100#Advancedconfiguration... spring.datasource.max-idle=8 spring.datasource.min-idle=8 spring.datasource.initial-size=10 spring.datasource.validation-query= spring.datasource.test-on-borrow=false spring.datasource.test-on-return=false spring.datasource.test-while-idle= spring.datasource.time-between-eviction-runs-millis= spring.datasource.min-evictable-idle-time-millis= spring.datasource.max-wait-millis= #MONGODB(MongoProperties) spring.data.mongodb.host=#thedbhost spring.data.mongodb.port=27017#theconnectionport(defaultsto27107) spring.data.mongodb.uri=mongodb://localhost/test#connectionURL spring.data.mongo.repositories.enabled=true#ifspringdatarepositorysupportisenabled #JPA(JpaBaseConfiguration,HibernateJpaAutoConfiguration) spring.jpa.properties.*=#propertiestosetontheJPAconnection spring.jpa.openInView=true spring.jpa.show-sql=true spring.jpa.database-platform= spring.jpa.database= spring.jpa.generate-ddl=false#ignoredbyHibernate,mightbeusefulforothervendors spring.jpa.hibernate.naming-strategy=#namingclassname spring.jpa.hibernate.ddl-auto=#defaultstocreate-dropforembeddeddbs spring.data.jpa.repositories.enabled=true#ifspringdatarepositorysupportisenabled #SOLR(SolrProperties}) spring.data.solr.host=http://127.0.0.1:8983/solr spring.data.solr.zkHost= spring.data.solr.repositories.enabled=true#ifspringdatarepositorysupportisenabled #ELASTICSEARCH(ElasticsearchProperties}) spring.data.elasticsearch.cluster-name=#Theclustername(defaultstoelasticsearch) spring.data.elasticsearch.cluster-nodes=#Theaddress(es)oftheservernode(comma-separated;ifnotspecifiedstartsaclientnode) spring.data.elasticsearch.local=true#iflocalmodeshouldbeusedwithclientnodes spring.data.elasticsearch.repositories.enabled=true#ifspringdatarepositorysupportisenabled #FLYWAY(FlywayProperties) flyway.locations=classpath:db/migrations#locationsofmigrationsscripts flyway.schemas=#schemastoupdate flyway.initVersion=1#versiontostartmigration flyway.prefix=V flyway.suffix=.sql flyway.enabled=true flyway.url=#JDBCurlifyouwantFlywaytocreateitsownDataSource flyway.user=#JDBCusernameifyouwantFlywaytocreateitsownDataSource flyway.password=#JDBCpasswordifyouwantFlywaytocreateitsownDataSource #LIQUIBASE(LiquibaseProperties) liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml liquibase.contexts=#runtimecontextstouse liquibase.default-schema=#defaultdatabaseschematouse liquibase.drop-first=false liquibase.enabled=true #JMX spring.jmx.enabled=true#ExposeMBeansfromSpring #RABBIT(RabbitProperties) spring.rabbitmq.host=#connectionhost spring.rabbitmq.port=#connectionport spring.rabbitmq.addresses=#connectionaddresses(e.g.myhost:9999,otherhost:1111) spring.rabbitmq.username=#loginuser spring.rabbitmq.password=#loginpassword spring.rabbitmq.virtualhost= spring.rabbitmq.dynamic= #REDIS(RedisProperties) spring.redis.host=localhost#serverhost spring.redis.password=#serverpassword spring.redis.port=6379#connectionport spring.redis.pool.max-idle=8#poolsettings... spring.redis.pool.min-idle=0 spring.redis.pool.max-active=8 spring.redis.pool.max-wait=-1 #ACTIVEMQ(ActiveMQProperties) spring.activemq.broker-url=tcp://localhost:61616#connectionURL spring.activemq.user= spring.activemq.password= spring.activemq.in-memory=true#brokerkindtocreateifnobroker-urlisspecified spring.activemq.pooled=false #HornetQ(HornetQProperties) spring.hornetq.mode=#connectionmode(native,embedded) spring.hornetq.host=localhost#hornetQhost(nativemode) spring.hornetq.port=5445#hornetQport(nativemode) spring.hornetq.embedded.enabled=true#iftheembeddedserverisenabled(needshornetq-jms-server.jar) spring.hornetq.embedded.serverId=#auto-generatedidoftheembeddedserver(integer) spring.hornetq.embedded.persistent=false#messagepersistence spring.hornetq.embedded.data-directory=#locationofdatacontent(whenpersistenceisenabled) spring.hornetq.embedded.queues=#commaseparatequeuestocreateonstartup spring.hornetq.embedded.topics=#commaseparatetopicstocreateonstartup spring.hornetq.embedded.cluster-password=#customerpassword(randomlygeneratedbydefault) #JMS(JmsProperties) spring.jms.pub-sub-domain=#falseforqueue(default),truefortopic #SPRINGBATCH(BatchDatabaseInitializer) spring.batch.job.names=job1,job2 spring.batch.job.enabled=true spring.batch.initializer.enabled=true spring.batch.schema=#batchschematoload #AOP spring.aop.auto= spring.aop.proxy-target-class= #FILEENCODING(FileEncodingApplicationListener) spring.mandatory-file-encoding=false #SPRINGSOCIAL(SocialWebAutoConfiguration) spring.social.auto-connection-views=true#Settotruefordefaultconnectionviewsorfalseifyouprovideyourown #SPRINGSOCIALFACEBOOK(FacebookAutoConfiguration) spring.social.facebook.app-id=#yourapplication'sFacebookAppID spring.social.facebook.app-secret=#yourapplication'sFacebookAppSecret #SPRINGSOCIALLINKEDIN(LinkedInAutoConfiguration) spring.social.linkedin.app-id=#yourapplication'sLinkedInAppID spring.social.linkedin.app-secret=#yourapplication'sLinkedInAppSecret #SPRINGSOCIALTWITTER(TwitterAutoConfiguration) spring.social.twitter.app-id=#yourapplication'sTwitterAppID spring.social.twitter.app-secret=#yourapplication'sTwitterAppSecret #SPRINGMOBILESITEPREFERENCE(SitePreferenceAutoConfiguration) spring.mobile.sitepreference.enabled=true#enabledbydefault #SPRINGMOBILEDEVICEVIEWS(DeviceDelegatingViewResolverAutoConfiguration) spring.mobile.devicedelegatingviewresolver.enabled=true#disabledbydefault spring.mobile.devicedelegatingviewresolver.normalPrefix= spring.mobile.devicedelegatingviewresolver.normalSuffix= spring.mobile.devicedelegatingviewresolver.mobilePrefix=mobile/ spring.mobile.devicedelegatingviewresolver.mobileSuffix= spring.mobile.devicedelegatingviewresolver.tabletPrefix=tablet/ spring.mobile.devicedelegatingviewresolver.tabletSuffix= #---------------------------------------- #ACTUATORPROPERTIES #---------------------------------------- #MANAGEMENTHTTPSERVER(ManagementServerProperties) management.port=#defaultsto'server.port' management.address=#bindtoaspecificNIC management.contextPath=#defaultto'/' #ENDPOINTS(AbstractEndpointsubclasses) endpoints.autoconfig.id=autoconfig endpoints.autoconfig.sensitive=true endpoints.autoconfig.enabled=true endpoints.beans.id=beans endpoints.beans.sensitive=true endpoints.beans.enabled=true endpoints.configprops.id=configprops endpoints.configprops.sensitive=true endpoints.configprops.enabled=true endpoints.configprops.keys-to-sanitize=password,secret endpoints.dump.id=dump endpoints.dump.sensitive=true endpoints.dump.enabled=true endpoints.env.id=env endpoints.env.sensitive=true endpoints.env.enabled=true endpoints.health.id=health endpoints.health.sensitive=false endpoints.health.enabled=true endpoints.info.id=info endpoints.info.sensitive=false endpoints.info.enabled=true endpoints.metrics.id=metrics endpoints.metrics.sensitive=true endpoints.metrics.enabled=true endpoints.shutdown.id=shutdown endpoints.shutdown.sensitive=true endpoints.shutdown.enabled=false endpoints.trace.id=trace endpoints.trace.sensitive=true endpoints.trace.enabled=true #MVCONLYENDPOINTS endpoints.jolokia.path=jolokia endpoints.jolokia.sensitive=true endpoints.jolokia.enabled=true#whenusingJolokia endpoints.error.path=/error #JMXENDPOINT(EndpointMBeanExportProperties) endpoints.jmx.enabled=true endpoints.jmx.domain=#theJMXdomain,defaultsto'org.springboot' endpoints.jmx.unique-names=false endpoints.jmx.enabled=true endpoints.jmx.staticNames= #JOLOKIA(JolokiaProperties) jolokia.config.*=#SeeJolokiamanual #REMOTESHELL shell.auth=simple#jaas,key,simple,spring shell.command-refresh-interval=-1 shell.command-path-pattern=#classpath*:/commands/**,classpath*:/crash/commands/** shell.config-path-patterns=#classpath*:/crash/* shell.disabled-plugins=false#don'texposeplugins shell.ssh.enabled=#sshsettings... shell.ssh.keyPath= shell.ssh.port= shell.telnet.enabled=#telnetsettings... shell.telnet.port= shell.auth.jaas.domain=#authenticationsettings... shell.auth.key.path= shell.auth.simple.user.name= shell.auth.simple.user.password= shell.auth.spring.roles= #GITINFO spring.git.properties=#resourcereftogeneratedgitinfopropertiesfile #SPRINGCONFIG(ConfigFileApplicationListener)
以上所述是小编给大家介绍的springbootapplicationproperties配置实例代码详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对毛票票网站的支持!