2018年5月29日火曜日

【エラー】
2018-05-29 23:25:39,958 [main] INFO  org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean -  Closing JPA EntityManagerFactory for persistence unit 'default'
2018-05-29 23:25:39,958 [main] INFO  org.apache.catalina.core.StandardService -  Stopping service Tomcat
2018-05-29 23:25:39,974 [main] INFO  org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer - 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-05-29 23:25:39,990 [main] ERROR org.springframework.boot.SpringApplication -  Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'responseEntityBuilder' defined in file [C:\Users\masaf\git\ApiLogic\target\classes\com\platfolio\api\builder\ResponseEntityBuilder.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'java.lang.Object' available: more than one 'primary' bean found among candidates: [org.springframework.context.annotation.internalConfigurationAnnotationProcessor, org.springframework.context.annotation.internalAutowiredAnnotationProcessor, org.springframework.context.annotation.internalRequiredAnnotationProcessor, org.springframework.context.annotation.internalCommonAnnotationProcessor, org.springframework.context.annotation.internalPersistenceAnnotationProcessor, org.springframework.context.event.internalEventListenerProcessor, org.springframework.context.event.internalEventListenerFactory, application, org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory, loginController, parentController, preschoolController, pushController, loginLogic, parentLogic, pushLogic, schoolLogic, childService, familyService, notificationHistoryService, parentService, pushService, schoolInfoService, loggingFilter, org.springframework.boot.autoconfigure.AutoConfigurationPackages, org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension#0, org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport_Predictor, emBeanDefinitionRegistrarPostProcessor, jpaMappingContext, jpaContext, loginUserRepository, schoolRepository, personRepository, familyRepository, childSchoolScheduleRepository, schoolUnitRepository, schoolEventScheduleRepository, notificationHistoryRepository, schoolGroupRepository, childRepository, org.springframework.boot.autoconfigure.domain.EntityScanPackages, org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration, org.springframework.boot.autoconfigure.condition.BeanTypeRegistry, propertySourcesPlaceholderConfigurer, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration, standardJacksonObjectMapperBuilderCustomizer, spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties, org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor, org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.store, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration, jacksonObjectMapperBuilder, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration, jacksonObjectMapper, org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration, jsonComponentModule, org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration$TomcatWebSocketConfiguration, websocketContainerCustomizer, org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration, org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat, tomcatEmbeddedServletContainerFactory, org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration, embeddedServletContainerCustomizerBeanPostProcessor, errorPageRegistrarBeanPostProcessor, org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration, dispatcherServlet, spring.mvc-org.springframework.boot.autoconfigure.web.WebMvcProperties, org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration, dispatcherServletRegistration, org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration, org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration, error, beanNameViewResolver, org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration, errorAttributes, basicErrorController, errorPageCustomizer, conventionErrorViewResolver, preserveErrorControllerTargetClassPostProcessor, spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration, requestMappingHandlerAdapter, requestMappingHandlerMapping, mvcPathMatcher, mvcUrlPathHelper, mvcContentNegotiationManager, viewControllerHandlerMapping, beanNameHandlerMapping, resourceHandlerMapping, mvcResourceUrlProvider, defaultServletHandlerMapping, mvcConversionService, mvcValidator, mvcUriComponentsContributor, httpRequestHandlerAdapter, simpleControllerHandlerAdapter, handlerExceptionResolver, mvcViewResolver, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration, faviconHandlerMapping, faviconRequestHandler, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter, defaultViewResolver, viewResolver, welcomePageHandlerMapping, requestContextFilter, org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration, hiddenHttpMethodFilter, httpPutFormContentFilter, org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration, mbeanExporter, objectNamingStrategy, mbeanServer, org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration, springApplicationAdminRegistrar, org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$JdkDynamicAutoProxyConfiguration, org.springframework.aop.config.internalAutoProxyCreator, org.springframework.boot.autoconfigure.aop.AopAutoConfiguration, org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration, spring.jta-org.springframework.boot.autoconfigure.transaction.jta.JtaProperties, org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat, dataSource, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$PooledDataSourceConfiguration, org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$TomcatDataSourcePoolMetadataProviderConfiguration, tomcatPoolDataSourceMetadataProvider, org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, dataSourceInitializer, spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties, dataSourceInitializerPostProcessor, org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration$JpaWebMvcConfiguration, openEntityManagerInViewInterceptor, org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, transactionManager, jpaVendorAdapter, entityManagerFactoryBuilder, entityManagerFactory, spring.jpa-org.springframework.boot.autoconfigure.orm.jpa.JpaProperties, dataSourceInitializedPublisher, org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration, org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration, persistenceExceptionTranslationPostProcessor, org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration, stringHttpMessageConverter, spring.http.encoding-org.springframework.boot.autoconfigure.web.HttpEncodingProperties, org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration, mappingJackson2HttpMessageConverter, org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration, org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration, messageConverters, org.springframework.data.web.config.SpringDataWebConfiguration, pageableResolver, sortResolver, org.springframework.data.web.config.SpringDataJacksonConfiguration, jacksonGeoModule, org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration, org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration, spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties, org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration, org.springframework.transaction.config.internalTransactionAdvisor, transactionAttributeSource, transactionInterceptor, org.springframework.transaction.config.internalTransactionalEventListenerFactory, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$TransactionManagementConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$DataSourceTransactionManagerConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration, jdbcTemplate, namedParameterJdbcTemplate, org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration, transactionTemplate, org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration, characterEncodingFilter, localeCharsetMappingsCustomizer, org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration, multipartConfigElement, multipartResolver, spring.http.multipart-org.springframework.boot.autoconfigure.web.MultipartProperties, org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration, serverProperties, duplicateServerPropertiesDetector, org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration$RestTemplateConfiguration, restTemplateBuilder, org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration, org.springframework.orm.jpa.SharedEntityManagerCreator#0, autoConfigurationReport, springApplicationArguments, springBootBanner, springBootLoggingSystem, environment, systemProperties, systemEnvironment, org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry, messageSource, applicationEventMulticaster, servletContext, contextParameters, contextAttributes]
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:749)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:189)
【概要】
DIの失敗

【詳細】
DIに失敗したエラー

Spring bootでクラスに@Componentアノテーションをつけて、DI可能にしたにもかかわらず
引数無しコンストラクタをなくしてしまった場合に発生する。

引数ありコンストラクタと、合わせて引数無しコンストラクタを記述することで解決する。

メッセージみてもさっぱり。

※引数ありコンストラクタがなければ、自動で引数無しコンストラクタが生成されるのでその場合は問題なし。(これは単にjavaの仕様)

0 件のコメント:

コメントを投稿