我的项目中有一个数据库监听器(DatabaseChangeListener
),这是一个线程。我在我的Spring Boot主应用程序中运行这个线程:
@SpringBootApplication
public class PocCamelRoutesManagerBootApplication {
public static void main(String[] args) {
SpringApplication.run(PocCamelRoutesManagerBootApplication.class, args);
}
@Autowired
private DataSource dataSource;
@Autowired
private RouteRepository routeRepository;
@Bean
public CommandLineRunner schedulingRunner(TaskExecutor executor) {
return args -> executor.execute(new DatabaseChangeListener(dataSource, routeRepository));
}
@Bean
public TaskExecutor taskExecutor() {
return new SimpleAsyncTaskExecutor();
}
}
DatabaseChangeListener d = new DatabaseChangeListener(); d.start()
),是来自Autowired
依赖项吗?答案 0 :(得分:0)
您必须在取消部署springboot应用时停止它,在类const Location = new Schema({
floors: [{
type: Schema.Types.ObjectId,
ref: 'FloorSchema',
}],
});
const FloorSchema = new Schema({
stores: [{
type: Schema.Types.ObjectId,
ref: 'StoreSchema',
}],
restrooms: [{
type: Schema.Types.ObjectId,
ref: 'RestroomSchema',
}],
benches: [{
type: Schema.Types.ObjectId,
ref: 'BenchSchema',
}],
});
中的以下方法中
PocCamelRoutesManagerBootApplication