如何使用从源代码构建的 Broadleaf Commerce CE?

问题描述 投票:0回答:1

https://github.com/BroadleafCommerce/BroadleafCommerce.git 克隆到我的笔记本电脑后,我 mvn 全新安装代码库,请问如何使用它来构建我自己的电子商务 Web 应用程序?

例如,

    <dependency>
      <groupId>org.broadleafcommerce</groupId>
      <artifactId>broadleaf-framework</artifactId>
      <version>6.2.11-SNAPSHOT</version>
    </dependency>

    <dependency>
      <groupId>org.broadleafcommerce</groupId>
      <artifactId>broadleaf-admin-module</artifactId>
      <version>6.2.11-SNAPSHOT</version>
    </dependency>

我将这 2 个依赖项包含在我的 pom.xml 中

@SpringBootApplication
@EnableBroadleafAdminAutoConfiguration
public class TestBroadleafApplication
{
    public static void main(String[] args)
    {
        SpringApplication.run(TestBroadleafApplication.class, args);
    }
}

但运气不佳,并出现以下错误:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field requestProcessor in org.broadleafcommerce.openadmin.web.filter.BroadleafAdminRequestFilter required a bean named 'blMergedDataSources' that could not be found.

The injection point has the following annotations:
    - @org.springframework.beans.factory.annotation.Autowired(required=true)
    - @org.springframework.beans.factory.annotation.Qualifier("blAdminRequestProcessor")


Action:

Consider defining a bean named 'blMergedDataSources' in your configuration.


Process finished with exit code 1
@Configuration
public class BroadleafConfiguration {

    @Bean(name = "blMergedDataSources")
    public Map<String, DataSource> dataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("org.h2.Driver");
        dataSource.setUrl("jdbc:h2:file:/data/demo");
        dataSource.setUsername("sa");
        dataSource.setPassword("");

        Map<String, DataSource> dataSources = new HashMap<>();
        dataSources.put("blPU", dataSource);

        return dataSources;
    }
}

尝试添加此配置类,但仍然出错。

e-commerce broadleaf-commerce
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.