Spring Boot YAML配置问题

桑托什

我正在使用yaml配置来配置我的spring boot应用程序。.yaml仅具有服务器的端口配置。但是,当我运行该应用程序时,YAML配置文件似乎没有从.yaml文件中选择端口号。我在下面提供了yaml和控制台输出。不知道为什么服务器不能在8282处启动,而仍然以默认值启动。

application.yaml配置

server:
      port:8282

控制台输出

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.2.6.RELEASE)

10:33:51 INFO                                           com.vti.Application logStarting               Starting Application on TUSGA00FLKHT01Q with PID 5408 (C:\svn-repository\ivr-callcenter-common-services\target\classes started by v579424 in C:\svn-repository\ivr-callcenter-common-services)
10:33:51 DEBUG                                          com.vti.Application logStarting               Running with Spring Boot v1.2.6.RELEASE, Spring v4.1.7.RELEASE
10:33:51 INFO  ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext prepareRefresh            Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3b2c72c2: startup date [Wed Sep 30 10:33:51 EDT 2015]; root of context hierarchy
10:33:52 INFO  rg.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions       Loading XML bean definitions from class path resource [spring/beans.xml]
10:33:53 INFO  ngframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition    Overriding bean definition for bean 'mvcContentNegotiationManager': replacing [Root bean: class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=mvcContentNegotiationManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]]
10:33:53 INFO  ngframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition    Overriding bean definition for bean 'mvcResourceUrlProvider': replacing [Root bean: class [org.springframework.web.servlet.resource.ResourceUrlProvider]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=mvcResourceUrlProvider; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]]
10:33:53 INFO  ngframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition    Overriding bean definition for bean 'mvcPathMatcher': replacing [Root bean: class [org.springframework.util.AntPathMatcher]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=mvcPathMatcher; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]]
10:33:53 INFO  ngframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition    Overriding bean definition for bean 'mvcUrlPathHelper': replacing [Root bean: class [org.springframework.web.util.UrlPathHelper]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=mvcUrlPathHelper; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]]
10:33:53 INFO  rk.context.annotation.ConfigurationClassBeanDefinitionReader iddenByExistingDefinition Skipping bean definition for [BeanMethod:name=mvcUriComponentsContributor,declaringClass=org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport]: a definition for bean 'mvcUriComponentsContributor' already exists. This top-level bean definition is considered as an override.
10:33:53 INFO  ngframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition    Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
10:33:54 INFO  framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties            Loading properties file from class path resource [framework_dev.properties]
10:33:54 INFO  framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties            Loading properties file from class path resource [data/testdata/testdata_dev.properties]
10:33:54 INFO  framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties            Loading properties file from class path resource [db/db_dev.properties]
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
10:33:54 INFO  t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$3e9fd57a] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10:33:54 INFO  t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10:33:54 INFO  t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10:33:54 INFO  t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10:33:54 INFO  t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'org.springframework.cache.annotation.ProxyCachingConfiguration' of type [class org.springframework.cache.annotation.ProxyCachingConfiguration$$EnhancerBySpringCGLIB$$a5fd9fd8] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10:33:54 INFO  t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'cacheOperationSource' of type [class org.springframework.cache.annotation.AnnotationCacheOperationSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10:33:54 INFO  t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'cacheInterceptor' of type [class org.springframework.cache.interceptor.CacheInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10:33:54 INFO  t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'org.springframework.cache.config.internalCacheAdvisor' of type [class org.springframework.cache.interceptor.BeanFactoryCacheOperationSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
10:33:55 INFO  .boot.context.embedded.tomcat.TomcatEmbeddedServletContainer initialize                Tomcat initialized with port(s): 8080 (http)
10:33:55 INFO                 org.springframework.web.context.ContextLoader ddedWebApplicationContext Root WebApplicationContext: initialization completed in 4473 ms
10:33:57 INFO  pringframework.boot.context.embedded.ServletRegistrationBean onStartup                 Mapping servlet: 'dispatcherServlet' to [/]
10:33:57 INFO  springframework.boot.context.embedded.FilterRegistrationBean configure                 Mapping filter: 'characterEncodingFilter' to: [/*]
10:33:57 INFO  springframework.boot.context.embedded.FilterRegistrationBean configure                 Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
10:33:57 INFO                  org.springframework.oxm.jaxb.Jaxb2Marshaller ateJaxbContextFromClasses Creating JAXBContext with classes to be bound [class com.vzt.ws.stubs.cca.ivrinfows.CallData,class com.vzt.ws.stubs.cca.ivrinfows.GetCallData,class com.vzt.ws.stubs.cca.ivrinfows.IvrTransfer,class com.vzt.ws.stubs.cca.ivrinfows.IvrTransferred,class com.vzt.ws.stubs.weather.Alert,class com.vzt.ws.stubs.weather.DataSet,class com.vzt.ws.stubs.weather.GetAll,class com.vzt.ws.stubs.weather.GetAllResponse,class com.vzt.ws.stubs.weather.Weather,class com.hughestelematics.htimessageheader.MessageHeaderT,class com.hughestelematics.xmlns.webservicesr.WebserviceSRRequest,class com.hughestelematics.xmlns.webservicesr.WebserviceSRReturn,class com.siebel.customui.UpdateSRTypeInput,class com.siebel.customui.UpdateSRTypeOutput,class com.hti.xmlns.webservicepstn.ObjectFactory,class com.hti.xmlns.webservicepstn.PSTNRequestT,class com.hti.xmlns.webservicepstn.PSTNReturnT,class com.hti.xmlns.webservicepstn.PSTNOutput,class com.vti.ws.stubs.provisioning.ApplicationBasicType,class com.vti.ws.stubs.provisioning.ApplicationDetailListRequest,class com.vti.ws.stubs.provisioning.ApplicationDetailListResponse,class com.vti.ws.stubs.provisioning.ApplicationType]
10:33:58 INFO   org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName        Loaded JDBC driver: oracle.jdbc.OracleDriver
10:33:58 INFO  .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler           Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/ctiAgentTransfer/{profileId}],methods=[GET]}" onto public com.vti.callcenter.model.TransferProfile com.vti.callcenter.web.CTIAgentTransferController.getTransferProfileByProfileId(java.lang.Integer)
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/ctiAgentTransfer/]}" onto public java.util.HashMap<java.lang.Integer, com.vti.callcenter.model.TransferProfile> com.vti.callcenter.web.CTIAgentTransferController.getTransferProfiles()
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/customAgentRoute/]}" onto public java.util.List<com.vti.callcenter.model.CustomRoute> com.vti.callcenter.web.CustomAgentRouteController.customAgentRoutes()
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/customAgentRoute/{mdn}],methods=[GET]}" onto public com.vti.callcenter.model.CustomRoute com.vti.callcenter.web.CustomAgentRouteController.getCustomRougeByMdn(java.lang.String)
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/ivrService/getAllRoutes],methods=[GET],produces=[application/json]}" onto public com.vti.callcenter.model.RouteParamsMap com.vti.callcenter.web.IVRRestController.getAllRouteParms()
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/ivrService/validateDnis],methods=[GET],produces=[text/plain]}" onto public java.lang.String com.vti.callcenter.web.IVRRestController.validateDnis(java.lang.String,java.lang.String)
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/middleware/getDeviceDetails/{mdn}],methods=[GET]}" onto public com.vti.callcenter.model.GetDeviceDetailsResponse com.vti.callcenter.web.MiddlewareRestController.getDeviceDetails(java.lang.String)
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3b2c72c2: startup date [Wed Sep 30 10:33:51 EDT 2015]; root of context hierarchy
10:33:58 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3b2c72c2: startup date [Wed Sep 30 10:33:51 EDT 2015]; root of context hierarchy
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3b2c72c2: startup date [Wed Sep 30 10:33:51 EDT 2015]; root of context hierarchy
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/ctiAgentTransfer/{profileId}],methods=[GET]}" onto public com.vti.callcenter.model.TransferProfile com.vti.callcenter.web.CTIAgentTransferController.getTransferProfileByProfileId(java.lang.Integer)
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/ctiAgentTransfer/]}" onto public java.util.HashMap<java.lang.Integer, com.vti.callcenter.model.TransferProfile> com.vti.callcenter.web.CTIAgentTransferController.getTransferProfiles()
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/customAgentRoute/]}" onto public java.util.List<com.vti.callcenter.model.CustomRoute> com.vti.callcenter.web.CustomAgentRouteController.customAgentRoutes()
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/customAgentRoute/{mdn}],methods=[GET]}" onto public com.vti.callcenter.model.CustomRoute com.vti.callcenter.web.CustomAgentRouteController.getCustomRougeByMdn(java.lang.String)
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/ivrService/getAllRoutes],methods=[GET],produces=[application/json]}" onto public com.vti.callcenter.model.RouteParamsMap com.vti.callcenter.web.IVRRestController.getAllRouteParms()
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/ivrService/validateDnis],methods=[GET],produces=[text/plain]}" onto public java.lang.String com.vti.callcenter.web.IVRRestController.validateDnis(java.lang.String,java.lang.String)
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/service/middleware/getDeviceDetails/{mdn}],methods=[GET]}" onto public com.vti.callcenter.model.GetDeviceDetailsResponse com.vti.callcenter.web.MiddlewareRestController.getDeviceDetails(java.lang.String)
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
10:33:59 INFO  b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod     Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
10:33:59 INFO  .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler           Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
10:33:59 INFO  .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler           Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
10:33:59 INFO  .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler           Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
10:33:59 INFO  pringframework.jmx.export.annotation.AnnotationMBeanExporter terSingletonsInstantiated Registering beans for JMX exposure on startup
10:33:59 INFO  .boot.context.embedded.tomcat.TomcatEmbeddedServletContainer start                     Tomcat started on port(s): 8080 (http)
10:33:59 INFO                                           com.vti.Application logStarted                Started Application in 8.7 seconds (JVM running for 9.813)
泽格勒布

将您的代码从此页面直接复制粘贴到我的项目中后,它也无法正常工作。它在端口前面有2个标签,需要在端口和空格之间插入空格::和8282之间没有空格(显然需要一个空格),这两个问题都导致它作为我的8080端口加载。 )

相反,我想出了这个

server:
    port: 8282

这对我有用。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章