logo
down
shadow

Spring Boot: Conditional on database type


Spring Boot: Conditional on database type

By : paavana
Date : November 27 2020, 11:01 PM
I wish did fix the issue. Some conditions are evaluated when the bean is actually created. If you want to check for the presence of a bean, you need to be very careful because any attempt to get a bean at that stage will lead to an early initialization. That's the first problem.
The second problem is that your configuration (app configuration) always run completely before the auto-configuration. If Spring Boot has to decide if it must create a DataSource, it should give the app configuration a chance to provide one.
code :


Share : facebook icon twitter icon
Spring Boot - Cannot determine embedded database driver class for database type NONE

Spring Boot - Cannot determine embedded database driver class for database type NONE


By : Đàm Thị Ngọc Lan
Date : March 29 2020, 07:55 AM
this one helps. You haven't provided Spring Boot with enough information to auto-configure a DataSource. To do so, you'll need to add some properties to application.properties with the spring.datasource prefix. Take a look at DataSourceProperties to see all of the properties that you can set.
You'll need to provide the appropriate url and driver class name:
code :
spring.datasource.url = …
spring.datasource.driver-class-name = …
spring-boot, spring-boot-starter-data-jpa: database type NONE or Cannot find changelog location

spring-boot, spring-boot-starter-data-jpa: database type NONE or Cannot find changelog location


By : churryck
Date : March 29 2020, 07:55 AM
This might help you GOT IT WORKING! Finally... What i did: delete HSQLDB from pom deb. Put liquidbaseautoconfiguration.class to exclude... 1 line of Code and 8 hours code reading.. here my Configuration Class. Hope i could help somebody:
code :
@Configuration
@EnableAutoConfiguration(exclude = 
            LiquibaseAutoConfiguration.class
          )
@EnableJpaRepositories("com.kage.bigdata.bida.repository.postgres")
public class PostgresConfig {


    @Bean
    public DataSource dataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("org.postgresql.Driver");
        dataSource.setUrl("jdbc:postgresql://127.0.0.1:5432/postgres");
        dataSource.setUsername("postgres");
        dataSource.setPassword("postgres");

        return dataSource;
    }

    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
        LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
        entityManagerFactoryBean.setDataSource(dataSource());
        entityManagerFactoryBean.setPackagesToScan("com.kage.bigdata.bida.model");
        entityManagerFactoryBean.setJpaProperties(buildHibernateProperties());
        entityManagerFactoryBean.setJpaProperties(new Properties() {{
            put("hibernate.current_session_context_class", SpringSessionContext.class.getName());
        }});
        entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter() {{
            setDatabase(Database.POSTGRESQL);
        }});
        return entityManagerFactoryBean;
    }



    protected Properties buildHibernateProperties()
    {
        Properties hibernateProperties = new Properties();

        hibernateProperties.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQL9Dialect");
        hibernateProperties.setProperty("hibernate.show_sql", "true");
        hibernateProperties.setProperty("hibernate.use_sql_comments", "false");
        hibernateProperties.setProperty("hibernate.format_sql", "false");
        hibernateProperties.setProperty("hibernate.hbm2ddl.auto", "create-drop");

        hibernateProperties.setProperty("hibernate.generate_statistics", "false");

        hibernateProperties.setProperty("javax.persistence.validation.mode", "none");

        //Audit History flags
        hibernateProperties.setProperty("org.hibernate.envers.store_data_at_delete", "true");
        hibernateProperties.setProperty("org.hibernate.envers.global_with_modified_flag", "true");

        return hibernateProperties;
    }

    @Bean
    public PlatformTransactionManager transactionManager() {
        return new JpaTransactionManager();
    }

    @Bean
    public TransactionTemplate transactionTemplate() {
        return new TransactionTemplate(transactionManager());
    }

}
Cannot determine embedded database driver class for database type NONE with Redis in Spring Boot

Cannot determine embedded database driver class for database type NONE with Redis in Spring Boot


By : syed
Date : March 29 2020, 07:55 AM
around this issue There is a couple of issues:
spring-boot-starter-redis is deprecated. Use spring-boot-starter-data-redis instead. Remove the spring-boot-starter-data-jpa dependency. Spring Data Redis does not support JPA and it's not needed. This is actually causing your error.
Spring boot Bean exception: Cannot determine embedded database driver class for database type NONE

Spring boot Bean exception: Cannot determine embedded database driver class for database type NONE


By : Sandeep Saini
Date : March 29 2020, 07:55 AM
should help you out I found a solution to run my application with Eclipse.
Before I tried to run my application using Java Application -> SpringApplication with the main class: org.springframework.boot.SpringApplication. Changing the main class to xxx.Application (where xxx is the projectname) works.
Spring Boot: Cannot determine embedded database driver class for database type NONE

Spring Boot: Cannot determine embedded database driver class for database type NONE


By : Kirill Lee
Date : March 29 2020, 07:55 AM
To fix this issue I think the following code addition to spring-config.xml might resolve the issue:
code :
<bean id="dataSource"
        class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="${DbDriverName}" />
        <property name="url" value="${DbUrl}" />
        <property name="username" value="${DbUsername}" />
        <property name="password" value="${DbPassword}" />
    </bean>
Related Posts Related Posts :
  • TACO Java Dependencies
  • Javafx filechooser name filter
  • No rule to make target `external/obpermissionjar/javalib/obpermissionjar-Pro20160628_1.0.9', needed by ..?
  • Spring Data REST: custom methods validation
  • JavaFX MousedMoved event ignored when mouse button is held down
  • ExecutorService and OutOfMemoryError: unable to create new native thread while using Executor
  • Java Security Manager completely disable reflection
  • Placement of Thread Content. How do you know what goes inside of the thread, and what doesn't?
  • can not search for txt files android 6.0
  • Monitor program using semaphore does not work as expected in java
  • A way to define / implement failover ldap servers in java code
  • How to save embedded object in POST call using Spring Data Rest
  • Methods in test in parallel way
  • What would be the best way to implement to check if the Post has been liked by the User using JPA and MySQL?
  • GCM unregister causing the application to crash
  • Test configuration annotations in separate annotation
  • How to catch third party console log using log4j
  • Java: Loading data from a file located under project folder fails
  • Epson epos sdk receipt alignment issue
  • Java Comparable: helper methods for isLessThan, isGreaterThan, isEqualTo
  • How to find the native method from the JVM source code?
  • Insert datetime string from java in MySQL
  • Regex look ahead to seperate string into tokens
  • How the java de-compiler get to know the variable or object names?
  • Java generics "capture of ?"
  • Specify the default value of the JSONP callback in spring using jackson?
  • Digital Signature created in C# doesn't match in Java verification
  • How to push down project, filter, aggregation to TableScan in Calcite
  • Java/SQL find duplicates
  • Getting a null error trying to add objects into an arraylist (simple piece of code)
  • JDBC query returning zero when using simple arithmetic operations and alias even though the data in table is not zero
  • incompatible type while adding value to Map
  • Openshift Build Failure - Failed to read artifact descriptor
  • updating neo4j database using java program
  • how to save an image to disk and retrive it with java/jsp
  • How to verify kerberos token?
  • String to byte array conversion varies from windows and ubuntu
  • Custom MavenResourcesFiltering hard to implement?
  • TestNG XML file failed to invoke/create the XSSFWorkbook
  • BigDecimal issue with long and lat
  • I am new to JavaFX. I want help on how to make a TreeView node Draggable and Droppable
  • Microservices and Messaging: Message Content
  • How to move an email service into a thread?
  • Reading a .csv file faster than reading same file compressed as .gz
  • How to change the json response fields to user defined fields in java?
  • Retrofit: Caused by: java.lang.IllegalArgumentException: Could not locate call adapter for CustomClass
  • Basic Authentication failed in Windows server 2012 Using Java
  • Avoid Transaction rollback in Spring
  • Transition between right - up, left - down, down - left etc. (JAVA game LWJGL keylistener)
  • How to setup a common classpath for all dependencies inside a maven project?
  • How is Mockito.mock better that using new while writing Junit tests?
  • In apache http client, how to keep the Content-Type in a StringBody as empty or null?
  • SQuirreL Configure: could not initial class org.apache.phoenix.jdbc.PhoenixDriver
  • ResponseEntity decode UTF-8
  • Time difference gives wrong value
  • How to read in and split a string of numbers separated by whitespace and forward slash
  • InvocationTargetException in javafx
  • method reference vs lambda expression
  • Scaling issue in BigDecimal(java) for exponential notation
  • What is causing my app to crash in this program? - Android Studio
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com