方式一:
在需要多實例的類上加入註解:
@Scope("prototype")
方式二:
在啓動類上加入:
@Bean @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS) public PrototypeClass prototypeClass() { return new PrototypeClass(); }
方式一:
在需要多實例的類上加入註解:
@Scope("prototype")
方式二:
在啓動類上加入:
@Bean @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS) public PrototypeClass prototypeClass() { return new PrototypeClass(); }
Spring boot 配置數據源 spring: mvc: favicon: enabled: false datasource: primary: username: root