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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Spring Boot 無法掃描多個(gè)模塊的注釋

Spring Boot 無法掃描多個(gè)模塊的注釋

12345678_0001 2024-01-25 10:31:53
我使用 Spring Boot 并通過多個(gè)模塊進(jìn)行設(shè)計(jì)。下面是我的項(xiàng)目結(jié)構(gòu):模塊商店核心:包名稱:com.baotrung.core.business 我設(shè)計(jì)了一些子包:模型,存儲(chǔ)庫,服務(wù)行長:<modelVersion>4.0.0</modelVersion>    <artifactId>shop-core</artifactId>    <packaging>jar</packaging>    <dependencies>        <!-- shop-core-model !-->        <dependency>            <groupId>com.baotrung</groupId>            <artifactId>shop-core-model</artifactId>            <version>0.0.1-SNAPSHOT</version>        </dependency>        <dependency>            <groupId>org.apache.commons</groupId>            <artifactId>commons-lang3</artifactId>            <version>3.9</version>        </dependency>        <dependency>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-starter-data-jpa</artifactId>        </dependency>    </dependencies>類別服務(wù) public interface CategoryService {    List<Object> countProductsByCategories(MerchantStore store, List<Long> categoryIds);    List<Category> listByStoreAndParent(MerchantStore store, Category category);    PersistableCategory saveCategories(MerchantStore store, PersistableCategory persistableCategory);    Category findById(Long id);    List<ReadableCategory> findCategories(MerchantStore store, int dept, Language language,List<String> filters);}類別 服務(wù)實(shí)施@Servicepublic class CategoryServiceImpl implements CategoryService {    @Autowired    private CategoriesRepository categoryRepository;    @Autowired    private LanguageRepository languageRepository;    @Autowired    private Mapper<Category,ReadableCategory> categoryReadableCategoryMapper;    //some method@存儲(chǔ)庫public interface CategoriesRepository extends CrudRepository<Category, Long>, CategoryRepositoryCustom { }public interface CategoryRepositoryCustom {    List<Object> countProductsByCategories(MerchantStore store, List<Long> categoryIds);    List<Category> listByStoreAndParent(MerchantStore store, Category category);    }@Repositorypublic class CategoryRepositoryCustomImpl implements CategoryRepositoryCustom {// some method impl}
查看完整描述

2 回答

?
開滿天機(jī)

TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超13個(gè)贊

我使用 Spring Boot 并通過多個(gè)模塊進(jìn)行設(shè)計(jì)。下面是我的項(xiàng)目結(jié)構(gòu):


模塊商店核心:包名稱:com.baotrung.core.business 我設(shè)計(jì)了一些子包:模型,存儲(chǔ)庫,服務(wù)


行長:


<modelVersion>4.0.0</modelVersion>


    <artifactId>shop-core</artifactId>

    <packaging>jar</packaging>


    <dependencies>

        <!-- shop-core-model !-->

        <dependency>

            <groupId>com.baotrung</groupId>

            <artifactId>shop-core-model</artifactId>

            <version>0.0.1-SNAPSHOT</version>

        </dependency>


        <dependency>

            <groupId>org.apache.commons</groupId>

            <artifactId>commons-lang3</artifactId>

            <version>3.9</version>

        </dependency>

        <dependency>

            <groupId>org.springframework.boot</groupId>

            <artifactId>spring-boot-starter-data-jpa</artifactId>

        </dependency>



    </dependencies>

類別服務(wù)


 public interface CategoryService {


    List<Object> countProductsByCategories(MerchantStore store, List<Long> categoryIds);


    List<Category> listByStoreAndParent(MerchantStore store, Category category);


    PersistableCategory saveCategories(MerchantStore store, PersistableCategory persistableCategory);


    Category findById(Long id);


    List<ReadableCategory> findCategories(MerchantStore store, int dept, Language language,List<String> filters);

}


類別 服務(wù)實(shí)施


@Service

public class CategoryServiceImpl implements CategoryService {


    @Autowired

    private CategoriesRepository categoryRepository;


    @Autowired

    private LanguageRepository languageRepository;


    @Autowired

    private Mapper<Category,ReadableCategory> categoryReadableCategoryMapper;


    //some method

@存儲(chǔ)庫


public interface CategoriesRepository extends CrudRepository<Category, Long>, CategoryRepositoryCustom {


 }


public interface CategoryRepositoryCustom {


    List<Object> countProductsByCategories(MerchantStore store, List<Long> categoryIds);


    List<Category> listByStoreAndParent(MerchantStore store, Category category);



    }


@Repository

public class CategoryRepositoryCustomImpl implements CategoryRepositoryCustom {


// some method impl

}

我還創(chuàng)建了模塊shopping-app p 并在其中使用了商店代碼依賴項(xiàng)。看起來像 :


查看完整回答
反對(duì) 回復(fù) 2024-01-25
?
ABOUTYOU

TA貢獻(xiàn)1812條經(jīng)驗(yàn) 獲得超5個(gè)贊

我建議您清理/重組您的包層次結(jié)構(gòu)以使其正常工作。

如果您將Application 類放在應(yīng)用程序的根包中,例如com.baotrung.shop,組件掃描將從該包向下開始。所有其他組件應(yīng)駐留在此包或子包中,事情會(huì)變得更容易,并且您需要更少的樣板代碼。將 Application 類放入其他組件的并行包(及以下)中(就像您所做的那樣)將強(qiáng)制您設(shè)置組件掃描的路徑,以查找這些(以及未來的)未按預(yù)期工作的組件。


查看完整回答
反對(duì) 回復(fù) 2024-01-25
  • 2 回答
  • 0 關(guān)注
  • 176 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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