Spring 單例bean是否線程安全 spring中的bean由@Scope註解定義是否為單例 @Scope(“singleton”) 單例,默認 @Scope(“prototype”) 多例 因此spring中bean默認單例 但單例bean也可能會導致線程不安全 這需要看bean有無狀態 有狀態: