調用 `btc.someMethod()` 拋 `NullPointerException`,截圖顯示 `btc` 為 `null`。
聲明了引用變量 `Btc btc;`,但**未實例化**(`new Btc()`)或**未注入**(Spring `@Autowired`、手動 `setBtc()`)。
@Service
public class MyService {
@Autowired private Btc btc; // 需 Btc 掛 @Component/@Service/@Repository
// 或構造器注入(推薦)
private final Btc btc;
public MyService(Btc btc) { this.btc = btc; }
}
Btc btc = BtcBuilder.create().withConfig(cfg).build();