为了能够测试应用程序的某些方面,我创建了这个测试设置。因为我需要ApplicationContext
的自定义实现,所以无法使用经典的SpringBootTest
注释来完成,而是使用了以下initialisazion:
public class CityWallSerializationTest extends SaveLoadBase<CityWall> {
private DependentAnnotationConfigApplicationContext context;
@BeforeEach
private void initialize() {
SpringApplicationBuilder builder = new SpringApplicationBuilder(SavegameTestApplication.class);
context = (DependentAnnotationConfigApplicationContext) builder.contextClass(DependentAnnotationConfigApplicationContext.class).profiles("server").run();
}
}
所敬畏的SaveMetestApplication:
@SpringBootApplication
@Import({ServerTestConfiguration.class})
@PropertySource(value = {"application.properties", "server.properties"})
public class SavegameTestApplication {
}
ServerTestConfiguration
是一个将某些配置和必需的bean结合在一起的配置:
@Configuration
@ActiveProfiles("server")
@Import(value = {ClientServerInterfaceServerConfiguration.class, ServerConfiguration.class, ImageConfiguration.class})
public class ServerTestConfiguration {
@Bean
public Jaxb2Marshaller jaxb2MarshallerImage() {
Jaxb2Marshaller bean = new Jaxb2Marshaller();
bean.setContextPath("ch.sahits.game.graphic.data.image");
return bean;
}
@Bean
public ITextSizing textSizing() {
return new ITextSizing() {
@Override
public Dimension2D calculate(int size, Font font) {
return null;
}
@Override
public Dimension2D calculate(String text, Font font) {
return null;
}
};
}
@Bean
public IEventPropagator serverEventPropagator() {
return message -> log.info("Propagate targeted event {}", message);
}
@Bean
public TestableLoadAndSaveService testableLoadAndSaveService() {
return new TestableLoadAndSaveService();
}
}
然后是引用的ClientServerInterfaceServerConfiguration
,其中有两个bean是自动连线的:
@Configuration
@Profile("server")
@Import({ClientServerInterfaceCommonConfiguration.class})
@ClassCategory(EClassCategory.STARTUP)
public class ClientServerInterfaceServerConfiguration {
@Autowired
@Qualifier("serverThreadPool")
private Executor serverThreadPool;
@Autowired
private SubscriptionLoggingExceptionHandler subscriptionExceptionHandler;
@Bean
public PausableAsyncEventBus clientServerEventBus() {
return new PausableAsyncEventBus(serverThreadPool, subscriptionExceptionHandler);
}
@Bean
public PausableSyncEventBus syncServerClientEventBus() {
return new PausableSyncEventBus(subscriptionExceptionHandler);
}
@Bean
public AsyncEventBus timerEventBus() {
return new AsyncEventBus(serverThreadPool, subscriptionExceptionHandler);
}
}
自动连线的两个bean是在导入的ClientServerInterfaceCommonConfiguration
中定义的。当我使用-dlogging.level.org.springframework=debug
启动测试时,我得到了实际找到的bean的日志输出(至少是输出的开始,由于不具有任何相关性,所以省略了大容量):
2019-12-11 17:07:52,487 [main] INFO c.i.r.j.JUnitStarter : The following profiles are active: server
2019-12-11 17:07:52,487 [main] DEBUG o.s.b.SpringApplication : Loading source class ch.sahits.game.savegame.SavegameTestApplication
2019-12-11 17:07:52,517 [main] DEBUG o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'file:/home/andi/development/intellij/OpenPatrician/OpenPatricianTest/target/classes/application.properties' (classpath:/application.properties)
2019-12-11 17:07:52,583 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianTest/target/test-classes/ch/sahits/game/savegame/ServerTestConfiguration.class]
2019-12-11 17:07:52,608 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/ClientServerInterfaceServerConfiguration.class]
2019-12-11 17:07:52,611 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/event/BuyWares.class]
2019-12-11 17:07:52,612 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/event/PostponedDisplayDialogMessage.class]
2019-12-11 17:07:52,613 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/event/PostponedDisplayMessage.class]
2019-12-11 17:07:52,615 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/logging/EventBusAspect.class]
2019-12-11 17:07:52,617 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/PathInterpolatorMap.class]
2019-12-11 17:07:52,624 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/AIStrategyLoader.class]
2019-12-11 17:07:52,625 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/BuildingFactory.class]
2019-12-11 17:07:52,626 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/CityFactory.class]
2019-12-11 17:07:52,627 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/GameFactory.class]
2019-12-11 17:07:52,627 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/MapSegmentImageFactory.class]
2019-12-11 17:07:52,628 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/PeopleFactory.class]
2019-12-11 17:07:52,628 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/PlayerInteractionFactory.class]
2019-12-11 17:07:52,628 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/ShipFactory.class]
2019-12-11 17:07:52,629 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/factory/StateFactory.class]
2019-12-11 17:07:52,629 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/task/CelebrationTask.class]
2019-12-11 17:07:52,630 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/task/MarriageTask.class]
2019-12-11 17:07:52,630 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/task/ReschedulableSailorHireTask.class]
2019-12-11 17:07:52,630 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/model/task/ReschedulableWeaponBuyTask.class]
2019-12-11 17:07:52,631 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/BuildingProduction.class]
2019-12-11 17:07:52,631 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/CelebrationService.class]
2019-12-11 17:07:52,632 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/CityProductionAndConsumptionService.class]
2019-12-11 17:07:52,632 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/ClientServerFactory.class]
2019-12-11 17:07:52,632 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/ClientServerTaskFactory.class]
2019-12-11 17:07:52,633 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/ConvoyService.class]
2019-12-11 17:07:52,633 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/DateService.class]
2019-12-11 17:07:52,634 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/DialogTemplateFactory.class]
2019-12-11 17:07:52,634 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/DifficultyPropertyInitializer.class]
2019-12-11 17:07:52,635 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/FormattedDateSupplier.class]
2019-12-11 17:07:52,635 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/GuildService.class]
2019-12-11 17:07:52,636 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/LinearDeadlinePremiumCalculator.class]
2019-12-11 17:07:52,636 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/LoanerService.class]
2019-12-11 17:07:52,636 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/MapProxy.class]
2019-12-11 17:07:52,637 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/MapService.class]
2019-12-11 17:07:52,637 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/ModelStateAccessor.class]
2019-12-11 17:07:52,637 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/OutriggerService.class]
2019-12-11 17:07:52,638 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/PlayerProductionService.class]
2019-12-11 17:07:52,638 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/PointService.class]
2019-12-11 17:07:52,639 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/ShipService.class]
2019-12-11 17:07:52,639 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/StrategyHolderService.class]
2019-12-11 17:07:52,640 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/service/TradeService.class]
2019-12-11 17:07:52,661 [main] DEBUG o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/ClientServerInterfaceServerConfiguration.class]
我无法理解的一个特殊情况是:为什么ClientServerInterfaceServerConfiguration
在列表中出现了两次,而ClientServerInterfaceCommonConfiguration
却全部缺失了?
这当然以未能构建应用程序上下文而告终:
原因:org.springframework.beans.factory.NoSuchBeanDefinitionException:没有“java.util.concurrent.executor”类型的合格bean可用:应至少有一个合格的自动候选bean。依赖项注释:{@org.SpringFramework.Beans.Factory.Annotation.AutoWired(required=true),@org.SpringFramework.Beans.Factory.Annotation.Qualifier(value=“ServerThreadPool”)}
更新:当运行跟踪日志记录时,还有一些更有趣的花絮:
2019-12-12 12:58:53,469 [main] TRACE o.s.c.a.ClassPathBeanDefinitionScanner : Scanning file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/ClientServerInterfaceCommonConfiguration.class]
2019-12-12 12:58:53,470 [main] TRACE o.s.c.a.ClassPathBeanDefinitionScanner : Ignored because not matching any filter: file [/home/andi/development/intellij/OpenPatrician/OpenPatricianClientServerInterface/target/classes/ch/sahits/game/openpatrician/clientserverinterface/ClientServerInterfaceCommonConfiguration.class]
这实际上是可以的,因为配置类在组件扫描时被忽略,因为它被导入。
2019-12-12 13:00:04,484 [main] TRACE o.s.c.a.ConfigurationClassBeanDefinitionReader : Registered bean definition for imported class 'ch.sahits.game.openpatrician.clientserverinterface.ClientServerInterfaceCommonConfiguration'
2019-12-12 13:00:04,484 [main] TRACE o.s.c.a.ConfigurationClassBeanDefinitionReader : Registering bean definition for @Bean method ch.sahits.game.openpatrician.clientserverinterface.ClientServerInterfaceCommonConfiguration.serverThreadPool()
2019-12-12 13:00:04,484 [main] TRACE o.s.c.a.ConfigurationClassBeanDefinitionReader : Registering bean definition for @Bean method ch.sahits.game.openpatrician.clientserverinterface.ClientServerInterfaceCommonConfiguration.subscriptionExceptionHandler()
实际处理了配置,并注册了bean(至少在定义读取器中)。实际的异常发生在下面:
2019-12-12 13:00:09,516 [main] TRACE o.s.b.f.s.DefaultListableBeanFactory : Creating instance of bean 'serverConfiguration'
2019-12-12 13:00:09,516 [main] TRACE o.s.b.f.a.InjectionMetadata : Registered injected element on class [ch.sahits.game.openpatrician.server.ServerConfiguration$$EnhancerBySpringCGLIB$$b77d1330]: AutowiredFieldElement for private java.util.concurrent.Executor ch.sahits.game.openpatrician.server.ServerConfiguration.serverThreadPool
2019-12-12 13:00:09,516 [main] TRACE o.s.b.f.a.InjectionMetadata : Registered injected element on class [ch.sahits.game.openpatrician.server.ServerConfiguration$$EnhancerBySpringCGLIB$$b77d1330]: AutowiredFieldElement for private ch.sahits.game.openpatrician.clientserverinterface.event.SubscriptionLoggingExceptionHandler ch.sahits.game.openpatrician.server.ServerConfiguration.subscriptionExceptionHandler
2019-12-12 13:00:09,516 [main] TRACE o.s.b.f.s.DefaultListableBeanFactory : Eagerly caching bean 'serverConfiguration' to allow for resolving potential circular references
2019-12-12 13:00:09,516 [main] TRACE o.s.b.CachedIntrospectionResults : Getting BeanInfo for class [ch.sahits.game.openpatrician.server.ServerConfiguration$$EnhancerBySpringCGLIB$$b77d1330]
2019-12-12 13:00:09,517 [main] TRACE o.s.b.CachedIntrospectionResults : Caching PropertyDescriptors for class [ch.sahits.game.openpatrician.server.ServerConfiguration$$EnhancerBySpringCGLIB$$b77d1330]
2019-12-12 13:00:09,517 [main] TRACE o.s.b.CachedIntrospectionResults : Found bean property 'beanFactory' of type [org.springframework.beans.factory.BeanFactory]
2019-12-12 13:00:09,517 [main] TRACE o.s.b.CachedIntrospectionResults : Found bean property 'class' of type [java.lang.Class]
2019-12-12 13:00:09,519 [main] TRACE o.s.b.f.a.InjectionMetadata : Processing injected element of bean 'serverConfiguration': AutowiredFieldElement for private java.util.concurrent.Executor ch.sahits.game.openpatrician.server.ServerConfiguration.serverThreadPool
2019-12-12 13:00:09,520 [main] TRACE o.s.b.TypeConverterDelegate : Converting String to [class java.lang.Class] using property editor [org.springframework.beans.propertyeditors.ClassEditor@538e74fc]
2019-12-12 13:00:09,520 [main] TRACE o.s.b.TypeConverterDelegate : Converting String to [class java.lang.Class] using property editor [org.springframework.beans.propertyeditors.ClassEditor@6475e778]
2019-12-12 13:00:09,520 [main] TRACE o.s.b.TypeConverterDelegate : Converting String to [class java.lang.Class] using property editor [org.springframework.beans.propertyeditors.ClassEditor@55b62db8]
2019-12-12 13:00:09,521 [main] WARN o.s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'serverConfiguration': Unsatisfied dependency expressed through field 'serverThreadPool'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.util.concurrent.Executor' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true), @org.springframework.beans.factory.annotation.Qualifier(value="serverThreadPool")}
因此,当尝试将ServerThreadPool
注入到导入ClientServerInterfaceServerConfiguration
的ClientServerInterfaceCommonConfiguration
中时,但当尝试将其注入到不导入ClientServerInterfaceCommonConfiguration
的ServerConfiguration
中时,不会发生异常。将其添加到ServerConfiguration
中解决了这个问题,但问题仍然存在:为什么在ServerConfiguration
中注入一个在不同的configuration
中定义的bean会出现问题,而两个配置类都是在相同的“父”配置中导入的呢?
“java.util.concurrent.executor”将指示缺少对TaskExecutor和TaskScheduler接口的任务的异步执行和调度。spring文档提供了注释支持。尝试将:@enableAsync&@enableScheduling->添加到@configuration类中。
示例:
@Configuration
@EnableAsync
@EnableScheduling
public class AppConfig {
}
有关更多详细信息和示例,请参见《spring-框架》。
我正在将一个非常基本的web应用程序部署到Google应用程序引擎。我使用的是Springboot,我可以在本地很好地运行应用程序,但当我部署到Google时,应用程序引擎不会启动实例。我在启动时配置了一个云SQL数据源。 我有云sql配置属性配置src/main/Resources/application.properties.App Engine似乎找不到这些属性,所以它无法正确设置Cloud
我是新的stackoverflow,但阅读吨的帖子在这里和现在stuck.myapplication.properties阅读,但配置hikaricp的部分被忽略/没有影响。 我读了https://www.javadevjournal.com/spring-boot/spring-boot-hikari/,在那里遵循了这些步骤,仍然取得了任何成功。 波姆。xml 应用属性 黑名单申请。课程: 配置
我试图将一个应用程序从spring-boot1迁移到Spring-Boot2,但是我在spring-boot部分遇到了很多困难: 我有这个日志: 上下文初始化期间遇到异常-取消刷新尝试:org.springframework.beans.factory.BeanCreationException:创建名为“org.springframework.boot.autocigure.liquibase.
我在IntelliJ Ultimate之前没有使用过。有人知道会出什么问题吗?我花了2个小时搜索我的问题的解决方案,但我没有找到任何东西。 src/main/resources/application的内容。属性:
我有一段扫描Spring上下文的代码: 我需要从文件,所以在类中,我有: (我从这里复制了YamlProperty tyLoaderFactory类) 是一个典型的Spring Boot文件,其中包含一些配置文件属性和默认配置文件: 在某些bean中,我使用读取属性。 当我运行我的应用程序,我传递变量,但我得到一个错误: 无法解析值“${file}”中的占位符“file” (由于applicati
我正在导入一个相当大的数据库。文件中几乎有1,000,000行。问题是我在尝试导入数据库时遇到语法错误。上面写着: 第8428420行错误1064(42000):您的SQL语法中有错误;检查与您的MySQL server版本相对应的手册,以获得在“ 致命错误:中超过600秒的最大执行时间”附近使用的正确语法 通常我会打开.sql文件并修复错误。但我的电脑真的很难打开这个文件。 在导入MySQL数据