java重复前缀

uidvcgyl  于 2021-06-29  发布在  Java
关注(0)|答案(0)|浏览(204)

我在用以下代码构建jhipster应用程序时遇到了问题。当我用gradle构建它时,它抛出了一个错误:
任务:compilejava注意:hibernate jpa 2 static metamodel generator 5.3.13.final c:\users\softdew\documents\store\src\main\java\com\mycompany\store\config\clouddatabaseconfiguration。java:25:错误:重复 @ConfigurationProperties 前缀'spring.datasource.hikari'public datasource datasource(cachemanager cachemanager){^
我是java开发的新手,对SpringBoot之类的东西不太熟悉。所以现在我很困惑,我看了不同的stackoverflow条目,我发现了一些解释,但我不能解决和使用它们为我的代码,我会非常高兴如果有人解释这个细节,并帮助我了解下面的代码如何工作。
谢谢大家<3

package com.myapp.config;
import org.hibernate.*;
import org.hibernate.cfg.*;

import io.github.jhipster.config.JHipsterProperties;
import io.github.jhipster.config.JHipsterConstants;

import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.boot.autoconfigure.orm.jpa.HibernatePropertiesCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.cache.CacheManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.config.java.AbstractCloudConfig;
import org.springframework.context.annotation.*;

import javax.sql.DataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;

@Profile(JHipsterConstants.SPRING_PROFILE_CLOUD)

public class CloudDatabaseConfiguration extends AbstractCloudConfig {

    public final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class);

    public static final String CLOUD_CONFIGURATION_HIKARI_PREFIX = "spring.datasource.hikari";

    @Bean
    @ConfigurationProperties(CLOUD_CONFIGURATION_HIKARI_PREFIX)
    public DataSource dataSource() {
        log.info("Configuring JDBC datasource from a cloud provider");
        return connectionFactory().dataSource();
    }
}

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题