第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我怎么能在spring框架上使用抽象類?

我怎么能在spring框架上使用抽象類?

桃花長相依 2019-04-18 14:15:27
我是那個傾向于使用Spring Boot編寫代碼的人。然后,當(dāng)我嘗試編寫使用抽象類的代碼時,我收到如下錯誤。Description:Parameter 0 of constructor in com.in28minutes.spring.practice.springmasterclasspractice.devicefactory. LaptopManufacturingProcess required a bean of type 'java.lang.String' that could not be found.Action:Consider defining a  bean of type 'java.lang.String' in your configuration.你們能告訴我如何解決這個錯誤嗎?Spring Boot:v2.1.4 Java:10.0.2 Maven:3.6.0SpringMasterClassPracticeDeviceFactoryApplication 類import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.boot.SpringApplication;import org.springframework. boot.autoconfigure.SpringBootApplication;import org.springframework.context.ConfigurableApplicationContext;@SpringBootApplicationpublic  class SpringMasterClassPracticeDeviceFactoryApplication {     private static Logger LOGGER = LoggerFactory.getLogger(SpringMasterClassPracticeDeviceFactoryApplication.class);     public static void main(String[] args) {         ConfigurableApplicationContext applicationContext = SpringApplication                 .run(SpringMasterClassPracticeDeviceFactoryApplication.class, args);         ManufacturingImpl manufacturingImpl = applicationContext.getBean(ManufacturingImpl.class);         System.out.println(manufacturingImpl);         // manufacturingImpl.manifactureProduct("Laptop Process");         LOGGER.info("{}", manufacturingImpl);     }}ManufacturingImpl 類import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory. annotation.Qualifier;import org.springframework.stereotype.Component;@Componentpublic class ManufacturingImpl {     @Autowired     @Qualifier("laptop")     private GeneralManufacturingProcess generalManufacturingProcess;     public void manifactureProduct(String processName) {         System.out.println(generalManufacturingProcess);         generalManufacturingProcess.launchProcess();     }}GeneralManufacturingProcess 類public abstract class GeneralManufacturingProcess {     private String processName;
查看完整描述

2 回答

?
哆啦的時光機(jī)

TA貢獻(xiàn)1779條經(jīng)驗 獲得超6個贊

generalManufacturingProcess是一個抽象類,無法實(shí)例化


查看完整回答
反對 回復(fù) 2019-05-15
  • 2 回答
  • 0 關(guān)注
  • 1189 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號