- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将现有的传统 Spring 应用程序转换为 Spring Boot。我已使用 @ImportResource 导入了 XML 配置,并在运行应用程序时导入。即使这个 bean 是在 XML 配置中配置的,它也会抛出注入(inject)失败。不确定这里出了什么问题
>Application.java
@Configuration
@ComponentScan("com.vzt")
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class })
public class Application {
public static void main(String[] args) {
ApplicationContext applicationContext = SpringApplication.run(
Application.class, args);
System.out.println("Let's inspect the beans provided by Spring Boot:");
String[] beanNames = applicationContext.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
}
@Configuration
@ImportResource("classpath:spring/beans.xml")
// @Profile("itest2") //commented it from the suggestion to set the
spring.profiles.active=itest2 on VM arguments
class XMLImportingConfiguration {
}
>XML 配置
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:web-services="http://www.springframework.org/schema/web-services"
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:util="http://www.springframework.org/schema/util"
xmlns:c="http://www.springframework.org/schema/c" xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<context:component-scan base-package="com.vzt" />
<!-- <oxm:jaxb2-marshaller id="marshaller" contextPath="com.vzt.ws.stubs.cca.ivrinfows"
/> -->
<!-- <jee:jndi-lookup id="ccaDataSource" jndi-name="java:/cca"
resource-ref="true" />
-->
<bean id="ccaDataSourceTest"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="oracle.jdbc.OracleDriver" />
<property name="url" value="${cca.jdbc.url}" />
<property name="username" value="${cca.jdbc.username}" />
<property name="password" value="${cca.jdbc.password}" />
</bean>
<bean id="ccaService" class="com.vzt.callcenter.service.CCAServiceImpl">
<!-- wire dependency -->
</bean>
<bean id="ccaRepository" class="com.vzt.callcenter.dao.CCARepository">
<property name="dataSource" ref="ccaDataSourceTest" />
</bean>
<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
<!-- IVR Info WS Request and Response Classes -->
<value>com.vzt.ws.stubs.cca.ivrinfows.CallData</value>
<value>com.vzt.ws.stubs.cca.ivrinfows.GetCallData</value>
<value>com.vzt.ws.stubs.cca.ivrinfows.IvrTransfer</value>
<value>com.vzt.ws.stubs.cca.ivrinfows.IvrTransferred</value>
<!-- Weather Data WS Request and Response Classes -->
<value>com.vzt.ws.stubs.weather.Alert</value>
<value>com.vzt.ws.stubs.weather.DataSet</value>
<value>com.vzt.ws.stubs.weather.GetAll</value>
<value>com.vzt.ws.stubs.weather.GetAllResponse</value>
<value>com.vzt.ws.stubs.weather.Weather</value>
<!-- MW (ESB) Webservice SR Request and Response Classes -->
<value>com.hughestelematics.htimessageheader.MessageHeaderT</value>
<value>com.hughestelematics.xmlns.webservicesr.WebserviceSRRequest
</value>
<value>com.hughestelematics.xmlns.webservicesr.WebserviceSRReturn
</value>
<!-- Siebel Webservice updateSRType Request and Response Classes -->
<value>com.siebel.customui.UpdateSRTypeInput</value>
<value>com.siebel.customui.UpdateSRTypeOutput</value>
<!-- MW (BPEL) Webservice SR PSTN Request and Response Classes -->
<value>com.hti.xmlns.webservicepstn.ObjectFactory</value>
<value>com.hti.xmlns.webservicepstn.PSTNRequestT</value>
<value>com.hti.xmlns.webservicepstn.PSTNReturnT</value>
<value>com.hti.xmlns.webservicepstn.PSTNOutput</value>
</list>
</property>
</bean>
<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
<property name="marshaller" ref="jaxb2Marshaller" />
<property name="unmarshaller" ref="jaxb2Marshaller" />
<constructor-arg ref="messageFactory" />
<!-- <property name="defaultUri" value="${ccawebservice.url}" /> -->
<property name="messageSender">
<bean
class="org.springframework.ws.transport.http.HttpComponentsMessageSender">
<property name="connectionTimeout" value="${cca.ivrinfo.webservice.timeout}" />
<property name="readTimeout" value="${cca.ivrinfo.webservice.timeout}" />
<property name="acceptGzipEncoding" value="false" />
</bean>
</property>
</bean>
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
<property name="messageFactory">
<bean
class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl" />
</property>
</bean>
<!-- <mvc:default-servlet-handler /> -->
<mvc:resources location="/resources/" mapping="/resources/**" />
<!-- <mvc:interceptors> <bean class = "com.vzt.nissan.interceptors.HttpRequestResponseLoggingInterceptor"/>
<bean class = "com.vzt.nissan.interceptors.AddSessionBeanInterceptor" />
</mvc:interceptors> -->
<context:annotation-config />
<mvc:annotation-driven />
<aop:aspectj-autoproxy />
<beans profile="dev">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:framework_dev.properties</value>
<value>classpath:data/testdata/testdata_dev.properties</value>
<value>classpath:db/db_dev.properties</value>
</list>
</property>
</bean>
</beans>
<beans profile="itest">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:framework_itest.properties</value>
<value>classpath:data/testdata/testdata_itest.properties</value>
<value>classpath:db/db_itest.properties</value>
</list>
</property>
</bean>
</beans>
<beans profile="itest2">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:framework_itest2.properties</value>
<value>classpath:data/testdata/testdata_itest2.properties</value>
<value>classpath:db/db_itest2.properties</value>
</list>
</property>
</bean>
</beans>
>CCAServiceImpl.java
package com.vzt.callcenter.service;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.ws.client.core.WebServiceTemplate;
import org.springframework.ws.soap.client.SoapFaultClientException;
import com.vzt.callcenter.constants.Constants;
import com.vzt.callcenter.model.GetCallDataByInteractionIdResponse;
import com.vzt.ws.stubs.cca.ivrinfows.CallData;
import com.vzt.ws.stubs.cca.ivrinfows.GetCallData;
import com.vzt.ws.stubs.cca.ivrinfows.IvrTransfer;
import com.vzt.ws.stubs.cca.ivrinfows.IvrTransferred;
import com.vzt.ws.stubs.cca.ivrinfows.ObjectFactory;
@Service
public class CCAServiceImpl implements CCAService {
@Autowired
private WebServiceTemplate webServiceTemplate;
static Logger logger = Logger.getLogger(CCAServiceImpl.class);
@Value("${cca.ivrinfo.webservice.url}")
private String webserviceUrl;
@Value("${cca.ivrinfo.webservice.timeout}")
private String webserviceTimeout;
public String getWebserviceUrl() {
return webserviceUrl;
}
public void setWebserviceUrl(String webserviceUrl) {
this.webserviceUrl = webserviceUrl;
}
public String getWebserviceTimeout() {
return webserviceTimeout;
}
public void setWebserviceTimeout(String webserviceTimeout) {
this.webserviceTimeout = webserviceTimeout;
}
/* (non-Javadoc)
* @see com.vzt.callcenter.service.CCAService#getCallDataByInteractionId(java.lang.String)
*/
@Override
public GetCallDataByInteractionIdResponse getCallDataByInteractionId(
String interactionId) {
//code not shown for brevity
return getCallDataByInteractionIdResponse;
}
/* (non-Javadoc)
* @see com.vzt.callcenter.service.CCAService#ivrTransfer(com.vzt.callcenter.model.IvrTransferRequest)
*/
@Override
public String ivrTransfer(com.vzt.callcenter.model.IvrTransferRequest ivrTransferRequest) {
logger.info("Request:" + ivrTransferRequest);
//code not shown for brevity
return Constants.WS_RC_CCAINFOWS_WSEXCEPTION;
}
}
>我执行 Spring Boot 时出错
编辑
Based on USER:axtavt comment, I made change to the
spring.active.profiles on run-time instead of using @Annotations. And
now I get the below error.
org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4260904e: startup date [Thu Dec 11 09:47:19 EST 2014]; root of context hierarchy
09:47:19 DEBUG ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext obtainFreshBeanFactory Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4260904e: org.springframework.beans.factory.support.DefaultListableBeanFactory@4db8738f: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,application]; root of factory hierarchy
09:47:20 INFO rg.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions Loading XML bean definitions from class path resource [spring/beans.xml]
09:47:21 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.web.servlet.config.annotation.DelegatingWebMvcConfiguration; factoryMethodName=mvcContentNegotiationManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]]
09:47:21 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.
09:47:21 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]]
09:47:21 INFO framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties Loading properties file from class path resource [framework_itest2.properties]
09:47:21 INFO framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties Loading properties file from class path resource [data/testdata/testdata_itest2.properties]
09:47:21 INFO framework.beans.factory.config.PropertyPlaceholderConfigurer loadProperties Loading properties file from class path resource [db/db_itest2.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.
09:47:22 INFO t.PostProcessorRegistrationDelegate$BeanPostProcessorChecker rocessAfterInitialization Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$acc877c3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
09:47:22 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)
09:47:22 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)
09:47:22 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)
09:47:22 DEBUG ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext initMessageSource Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@773fe60f]
09:47:22 DEBUG ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext plicationEventMulticaster Using ApplicationEventMulticaster [org.springframework.context.event.SimpleApplicationEventMulticaster@4191ff3]
09:47:22 DEBUG ontext.embedded.tomcat.TomcatEmbeddedServletContainerFactory etArchiveFileDocumentRoot Code archive: C:\Users\v579424\.m2\repository\org\springframework\boot\spring-boot\1.1.7.RELEASE\spring-boot-1.1.7.RELEASE.jar
09:47:22 DEBUG ontext.embedded.tomcat.TomcatEmbeddedServletContainerFactory plodedWarFileDocumentRoot Code archive: C:\Users\v579424\.m2\repository\org\springframework\boot\spring-boot\1.1.7.RELEASE\spring-boot-1.1.7.RELEASE.jar
09:47:22 DEBUG ontext.embedded.tomcat.TomcatEmbeddedServletContainerFactory getValidDocumentRoot Document root: C:\Users\v579424\Documents\workspace-sts-3.4.0.RELEASE\VZTCallCenterFramework\src\main\webapp
09:47:22 INFO ontext.embedded.tomcat.TomcatEmbeddedServletContainerFactory tEmbeddedServletContainer Server initialized with port: 8080
09:47:22 INFO org.springframework.web.context.ContextLoader ddedWebApplicationContext Root WebApplicationContext: initialization completed in 3087 ms
09:47:23 INFO pringframework.boot.context.embedded.ServletRegistrationBean onStartup Mapping servlet: 'dispatcherServlet' to [/]
09:47:23 INFO springframework.boot.context.embedded.FilterRegistrationBean configure Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
09:47:26 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]
09:47:27 INFO org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName Loaded JDBC driver: oracle.jdbc.OracleDriver
09:47:27 INFO .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
09:47:27 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/service/customAgentRoute/],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<com.vzt.callcenter.model.CustomRoute> com.vzt.callcenter.web.CustomAgentRouteController.customAgentRoutes()
09:47:27 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/service/customAgentRoute/{mdn}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public com.vzt.callcenter.model.CustomRoute com.vzt.callcenter.web.CustomAgentRouteController.getCustomRougeByMdn(java.lang.String)
09:47:27 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" 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)
09:47:27 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
09:47:28 INFO .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
09:47:28 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/service/customAgentRoute/],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<com.vzt.callcenter.model.CustomRoute> com.vzt.callcenter.web.CustomAgentRouteController.customAgentRoutes()
09:47:28 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/service/customAgentRoute/{mdn}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public com.vzt.callcenter.model.CustomRoute com.vzt.callcenter.web.CustomAgentRouteController.getCustomRougeByMdn(java.lang.String)
09:47:28 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" 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)
09:47:28 INFO b.servlet.mvc.method.annotation.RequestMappingHandlerMapping registerHandlerMethod Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
09:47:28 INFO .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
09:47:28 INFO .springframework.web.servlet.handler.SimpleUrlHandlerMapping registerHandler Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
09:47:28 INFO pringframework.jmx.export.annotation.AnnotationMBeanExporter afterPropertiesSet Registering beans for JMX exposure on startup
09:47:28 DEBUG ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext initLifecycleProcessor Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@27b6c151]
09:47:28 DEBUG oconfigure.logging.AutoConfigurationReportLoggingInitializer ogAutoConfigurationReport
09:47:28 ERROR org.springframework.boot.SpringApplication run Application startup failed
java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:154)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:272)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:132)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at com.vzt.Application.main(Application.java:28)
09:47:28 INFO ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext doClose Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4260904e: startup date [Thu Dec 11 09:47:19 EST 2014]; root of context hierarchy
09:47:28 INFO pringframework.jmx.export.annotation.AnnotationMBeanExporter destroy Unregistering JMX-exposed beans on shutdown
Exception in thread "main" java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:154)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:272)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:132)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at com.vzt.Application.main(Application.java:28)
**
最佳答案
通过在 VM 参数上传递 spring.profiles.active=itest2 而不是将其设置为如下所示的注释来修复此问题。不确定,为什么 spring-boot 不允许使用注释进行配置。
@Configuration
@ImportResource("classpath:spring/beans.xml")
@Profile("itest2")
class XMLImportingConfiguration {
}
关于java - Spring Boot 应用程序无法 Autowiring XML 配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27425274/
我正在编写一个具有以下签名的 Java 方法。 void Logger(Method method, Object[] args); 如果一个方法(例如 ABC() )调用此方法 Logger,它应该
我是 Java 新手。 我的问题是我的 Java 程序找不到我试图用作的图像文件一个 JButton。 (目前这段代码什么也没做,因为我只是得到了想要的外观第一的)。这是我的主课 代码: packag
好的,今天我在接受采访,我已经编写 Java 代码多年了。采访中说“Java 垃圾收集是一个棘手的问题,我有几个 friend 一直在努力弄清楚。你在这方面做得怎么样?”。她是想骗我吗?还是我的一生都
我的 friend 给了我一个谜语让我解开。它是这样的: There are 100 people. Each one of them, in his turn, does the following
如果我将使用 Java 5 代码的应用程序编译成字节码,生成的 .class 文件是否能够在 Java 1.4 下运行? 如果后者可以工作并且我正在尝试在我的 Java 1.4 应用程序中使用 Jav
有关于why Java doesn't support unsigned types的问题以及一些关于处理无符号类型的问题。我做了一些搜索,似乎 Scala 也不支持无符号数据类型。限制是Java和S
我只是想知道在一个 java 版本中生成的字节码是否可以在其他 java 版本上运行 最佳答案 通常,字节码无需修改即可在 较新 版本的 Java 上运行。它不会在旧版本上运行,除非您使用特殊参数 (
我有一个关于在命令提示符下执行 java 程序的基本问题。 在某些机器上我们需要指定 -cp 。 (类路径)同时执行java程序 (test为java文件名与.class文件存在于同一目录下) jav
我已经阅读 StackOverflow 有一段时间了,现在我才鼓起勇气提出问题。我今年 20 岁,目前在我的家乡(罗马尼亚克卢日-纳波卡)就读 IT 大学。足以介绍:D。 基本上,我有一家提供簿记应用
我有 public JSONObject parseXML(String xml) { JSONObject jsonObject = XML.toJSONObject(xml); r
我已经在 Java 中实现了带有动态类型的简单解释语言。不幸的是我遇到了以下问题。测试时如下代码: def main() { def ks = Map[[1, 2]].keySet()
一直提示输入 1 到 10 的数字 - 结果应将 st、rd、th 和 nd 添加到数字中。编写一个程序,提示用户输入 1 到 10 之间的任意整数,然后以序数形式显示该整数并附加后缀。 public
我有这个 DownloadFile.java 并按预期下载该文件: import java.io.*; import java.net.URL; public class DownloadFile {
我想在 GUI 上添加延迟。我放置了 2 个 for 循环,然后重新绘制了一个标签,但这 2 个 for 循环一个接一个地执行,并且标签被重新绘制到最后一个。 我能做什么? for(int i=0;
我正在对对象 Student 的列表项进行一些测试,但是我更喜欢在 java 类对象中创建硬编码列表,然后从那里提取数据,而不是连接到数据库并在结果集中选择记录。然而,自从我这样做以来已经很长时间了,
我知道对象创建分为三个部分: 声明 实例化 初始化 classA{} classB extends classA{} classA obj = new classB(1,1); 实例化 它必须使用
我有兴趣使用 GPRS 构建车辆跟踪系统。但是,我有一些问题要问以前做过此操作的人: GPRS 是最好的技术吗?人们意识到任何问题吗? 我计划使用 Java/Java EE - 有更好的技术吗? 如果
我可以通过递归方法反转数组,例如:数组={1,2,3,4,5} 数组结果={5,4,3,2,1}但我的结果是相同的数组,我不知道为什么,请帮助我。 public class Recursion { p
有这样的标准方式吗? 包括 Java源代码-测试代码- Ant 或 Maven联合单元持续集成(可能是巡航控制)ClearCase 版本控制工具部署到应用服务器 最后我希望有一个自动构建和集成环境。
我什至不知道这是否可能,我非常怀疑它是否可能,但如果可以,您能告诉我怎么做吗?我只是想知道如何从打印机打印一些文本。 有什么想法吗? 最佳答案 这里有更简单的事情。 import javax.swin
我是一名优秀的程序员,十分优秀!