Beancreationexception error creating bean with name liquibase defined in class path resource

I have this annoying error when starting Embedded Tomcat on my jHipster Project. Spent a lot of time trying to resolve it but can't figure out why it's happening. It started happening after updating

I have this annoying error when starting Embedded Tomcat on my jHipster Project. Spent a lot of time trying to resolve it but can’t figure out why it’s happening. It started happening after updating project from main rep but I also implemented Custom Repository.

Stack Trace:

    DEBUG] uk.co.
config.DatabaseConfiguration - Configuring Liquibase
[WARN] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered d
uring context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path
 resource [uk/co/inspiresoft/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is
liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          classpath:config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster is now: 7:bde
7b076d47aefe8278d126cde26b172

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1574) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:539) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spr
ing-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:230) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[sprin
g-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-
beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListable
BeanFactory.java:755) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplic
ationContext.java:757) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~
[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext
.java:118) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686) [spring-boot-1.2.3.RELEASE.jar
:1.2.3.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.2.3.RELEASE.jar:1.2
.3.RELEASE]
        at uk.co.Application.main(Application.java:59) [classes/:na]
Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          classpath:config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster is now: 7:bde
7b076d47aefe8278d126cde26b172

        at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:196) ~[liquibase-core-3.3.2.jar:na]
        at liquibase.Liquibase.update(Liquibase.java:196) ~[liquibase-core-3.3.2.jar:na]
        at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:353) ~[liquibase-core-3.3.2.j
ar:na]
        at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:317) ~[liquibase-core-3.
3.2.jar:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowi
reCapableBeanFactory.java:1633) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1570) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        ... 13 common frames omitted
[INFO] uk.co.config.CacheConfiguration - Closing Cache Manager
[INFO] com.hazelcast.core.LifecycleService - [192.168.1.48]:5701 [dev] [3.4] Address[192.168.1.48]:5701 is SHUTTING_DOWN

This is my DatabaseConfiguration.class

    import java.util.Arrays;

import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import liquibase.integration.spring.SpringLiquibase;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.codahale.metrics.MetricRegistry;
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

@Configuration
@EnableJpaRepositories(repositoryFactoryBeanClass=uk.co.repository.IRepositoryFactoryBean.class, basePackages={"uk.co.repository"})
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
@EnableTransactionManagement
public class DatabaseConfiguration implements EnvironmentAware {

    private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);

    private RelaxedPropertyResolver propertyResolver;

    private Environment env;

    @Autowired(required = false)
    private MetricRegistry metricRegistry;

    @Override
    public void setEnvironment(Environment env) {
        this.env = env;
        this.propertyResolver = new RelaxedPropertyResolver(env, "spring.datasource.");
    }

    @Bean(destroyMethod = "shutdown")
    @ConditionalOnMissingClass(name = "uk.co.config.HerokuDatabaseConfiguration")
    @Profile("!" + Constants.SPRING_PROFILE_CLOUD)
    public DataSource dataSource() {
        log.debug("Configuring Datasource");
        if (propertyResolver.getProperty("url") == null && propertyResolver.getProperty("databaseName") == null) {
            log.error("Your database connection pool configuration is incorrect! The application" +
                    "cannot start. Please check your Spring profile, current profiles are: {}",
                    Arrays.toString(env.getActiveProfiles()));

            throw new ApplicationContextException("Database connection pool is not configured correctly");
        }
        HikariConfig config = new HikariConfig();
        config.setDataSourceClassName(propertyResolver.getProperty("dataSourceClassName"));
        if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) {
            config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName"));
            config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName"));
        } else {
            config.addDataSourceProperty("url", propertyResolver.getProperty("url"));
        }
        config.addDataSourceProperty("user", propertyResolver.getProperty("username"));
        config.addDataSourceProperty("password", propertyResolver.getProperty("password"));

        if (metricRegistry != null) {
            config.setMetricRegistry(metricRegistry);
        }
        return new HikariDataSource(config);
    }

    @Bean
    public SpringLiquibase liquibase(DataSource dataSource) {
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setDataSource(dataSource);
        liquibase.setChangeLog("classpath:config/liquibase/master.xml");
        liquibase.setContexts("development, production");
        if (env.acceptsProfiles(Constants.SPRING_PROFILE_FAST)) {
            if ("org.h2.jdbcx.JdbcDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) {
                liquibase.setShouldRun(true);
                log.warn("Using '{}' profile with H2 database in memory is not optimal, you should consider switching to" +
                    " MySQL or Postgresql to avoid rebuilding your database upon each start.", Constants.SPRING_PROFILE_FAST);
            } else {
                liquibase.setShouldRun(false);
            }
        } else {
            log.debug("Configuring Liquibase");
        }
        return liquibase;
    }

    @Bean
    public Hibernate4Module hibernate4Module() {
        return new Hibernate4Module();
    }

    @Bean
    public EntityManagerFactory entityManagerFactory() {

      HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
      vendorAdapter.setGenerateDdl(true);

      LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
      factory.setJpaVendorAdapter(vendorAdapter);
      factory.setPackagesToScan("uk.co.repository");
      factory.setDataSource(dataSource());
      factory.afterPropertiesSet();

      return factory.getObject();
    }
}

Всем привет, не так давно решил освоить инструмент для миграции данных — liquibase.
При компиляции кода(приложу ниже) возникает такая ошибка:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ChangeLogParseException: Error parsing classpath:db/changelog/liquibase-changelog.yml

Структура:
63637dd298ffc232897085.png
Есть модель работника:

@Entity // This tells Hibernate to make a table out of this class
@Table(name = "name")
public class Employees {
    
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private Integer id;
    @Column
    private String name;
    @Column
    private String lastname;
    @Column
    private String secondname;
    @Column
    private String Work;
    @Column
    private String sex;
    @Column
    private String dateofbirth;
    @Column
    private String number;

Так же есть changelog.yml:

databaseChangeLog:

  - include:
      file: db/changelog/insertdata.xml

Employee.xml:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet id="01" author="Realssocks">
        <createTable tableName="employees"
                     remarks="A table to contain all employees">
            <column name="id" type="int" autoIncrement="true">
                <constraints nullable="false" unique="true" primaryKey="true"/>
            </column>
            <column name="name" type="varchar(255)">
                <constraints nullable="false" />
            </column>
            <column name="secondname" type="int">
                <constraints nullable="false"/>
            </column>
            <column name="lastname" type="int">
                <constraints nullable="false"/>
            </column>
            <column name="sex" type="int">
                <constraints nullable="false"/>
            </column>
            <column name="Work" type="int">
                <constraints nullable="false"/>
            </column>
            <column name="dateofbirth" type="int">
                <constraints nullable="false"/>
            </column>
            <column name="number" type="int">
                <constraints nullable="false"/>
            </column>
        </createTable>
    </changeSet>
</databaseChangeLog>

insertdata.xml:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

    <changeSet id="03" author="Realsocks">
        <comment>Inserting Employee</comment>
        <insert tableName="employee">
            <column name="id" valueNumeric="1"/>
            <column name="name" value="Kirill"/>
            <column name="secondname" value="Zheltov"/>
            <column name="lastname" value="Romanovich"/>
            <column name="sex" value="Male"/>
            <column name="Work" value="Work"/>
            <column name="dateofbirth" value="17/05/2003"/>
            <column name="number" value="0000000"/>
        </insert>
        <insert tableName="employee">
            <column name="id" valueNumeric="2"/>
            <column name="name" value="Kirill1"/>
            <column name="secondname" value="Zheltov1"/>
            <column name="lastname" value="Romanovich1"/>
            <column name="sex" value="Male1"/>
            <column name="Work" value="Work1"/>
            <column name="dateofbirth" value="17/05/20031"/>
            <column name="number" value="00000001"/>
        </insert>
        <insert tableName="employee">
            <column name="id" valueNumeric="3"/>
            <column name="name" value="Kirill2"/>
            <column name="secondname" value="Zheltov2"/>
            <column name="lastname" value="Romanovich2"/>
            <column name="sex" value="Male2"/>
            <column name="Work" value="Work2"/>
            <column name="dateofbirth" value="17/05/20032"/>
            <column name="number" value="00000002"/>
        </insert>
        <insert tableName="employee">
            <column name="id" valueNumeric="4"/>
            <column name="name" value="Kirill3"/>
            <column name="secondname" value="Zheltov3"/>
            <column name="lastname" value="Romanovich3"/>
            <column name="sex" value="Male3"/>
            <column name="Work" value="Work3"/>
            <column name="dateofbirth" value="17/05/20033"/>
            <column name="number" value="00000003"/>
        </insert>
        <insert tableName="employee">
            <column name="id" valueNumeric="5"/>
            <column name="name" value="Kirill4"/>
            <column name="secondname" value="Zheltov4"/>
            <column name="lastname" value="Romanovich4"/>
            <column name="sex" value="Male4"/>
            <column name="Work" value="Work4"/>
            <column name="dateofbirth" value="17/05/20034"/>
            <column name="number" value="00000004"/>
        </insert>
    </changeSet>
</databaseChangeLog>

Application.properties:

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.show-sql=true
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=username
spring.datasource.password=password
spring.liquibase.change-log=classpath:db/changelog/liquibase-changelog.yml
server.port=8081
spring.liquibase.enabled=true
spring.jpa.hibernate.ddl-auto=none
spring.h2.console.enabled=true

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.7.5</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.example</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>demo</name>
	<description>Demo project for Spring Boot</description>
	<properties>
		<java.version>19</java.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>

			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>

		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
		</dependency>
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<scope>runtime</scope>
		</dependency>
		<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-thymeleaf</artifactId>
		</dependency>
		<dependency>
			<groupId>org.liquibase</groupId>
			<artifactId>liquibase-core</artifactId>
		</dependency>
	</dependencies>



	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<excludes>
						<exclude>
							<groupId>org.projectlombok</groupId>
							<artifactId>lombok</artifactId>
						</exclude>
					</excludes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.liquibase</groupId>
				<artifactId>liquibase-maven-plugin</artifactId>

				<configuration>
					<propertyFile>src/main/resources/liquibase.properties</propertyFile>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>

проект делал по примеру видео-урока с ютуба, видел пару похожих вопросов, но их решения к сожалению не помогли, буду рад любой помощи!

Содержание

  1. BeanCreationException: Error creating bean with name
  2. NoSuchBeanDefinitionException: No qualifying bean of type
  3. NoSuchBeanDefinitionException: No qualifying bean of type
  4. NoSuchBeanDefinitionException: No bean named available
  5. NoSuchBeanDefinitionException: No bean named available
  6. BeanCurrentlyInCreationException: Error creating bean with name: Requested bean is currently in creation
  7. BeanCurrentlyInCreationException: Error creating bean with name: Requested bean is currently in creation
  8. NoUniqueBeanDefinitionException: No qualifying bean of type available: expected single matching bean but found
  9. NoUniqueBeanDefinitionException: No qualifying bean of type available: expected single matching bean but found
  10. BeanInstantiationException: Failed to instantiate: No default constructor found
  11. BeanInstantiationException: Failed to instantiate: No default constructor found
  12. BeanInstantiationException: Failed to instantiate: Constructor threw exception
  13. BeanInstantiationException: Failed to instantiate: Constructor threw exception
  14. BeanInstantiationException: Failed to instantiate: Factory method threw exception
  15. BeanInstantiationException: Failed to instantiate: Factory method threw exception
  16. Bitbucket Support
  17. Knowledge base
  18. Products
  19. Jira Software
  20. Jira Service Management
  21. Jira Work Management
  22. Confluence
  23. Bitbucket
  24. Resources
  25. Documentation
  26. Community
  27. Suggestions and bugs
  28. Marketplace
  29. Billing and licensing
  30. Viewport
  31. Confluence
  32. SpringMVC dispatcher could not be started
  33. Related content
  34. Still need help?
  35. Problem
  36. Resolution

BeanCreationException: Error creating bean with name

The spring boot exception org.springframework.beans.factory.BeanCreationException: Error creating bean with name happens when a problem occurs when the BeanFactory creates a bean. If the BeanFactory encounters an error when creating a bean from either bean definition or auto-configuration, the BeanCreationException will be thrown. The exception Error creating bean with name defined in file happens most of the time in the @Autowired annotation.

If BeanCreationException is found in the spring boot application, the nested exception would reveal the root cause of the exception. There are multiple nested exceptions that trigger BeanCreationException: Error creating bean with name in the spring boot application.

The nested exception will help you to fix BeanCreationException. The following list describes the common root causes that are seen in the nested exception.

NoSuchBeanDefinitionException: No qualifying bean of type

This exception occurs when the bean is not available or defined while auto-wired in another class.

s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘zoo’: Unsatisfied dependency expressed through field ‘lion’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.yawintutor.Lion’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:

If the root cause exception is displayed as No qualifying bean of type then follow the link below to resolve this exception.

NoSuchBeanDefinitionException: No qualifying bean of type

NoSuchBeanDefinitionException: No bean named available

This exception happens when you try to access a bean that is not available or is not defined in the spring boot context.

Exception in thread “main” org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘lion1’ available

If the root cause exception is displayed as No qualifying bean of type then follow the link below to resolve this exception.

NoSuchBeanDefinitionException: No bean named available

BeanCurrentlyInCreationException: Error creating bean with name: Requested bean is currently in creation

This exception happens when two beans are in circular dependences with each other.

s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘department’ defined in file [/SpringBootBean/target/classes/com/yawintutor/Department.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘lion’ defined in file [/SpringBootBean/target/classes/com/yawintutor/Lion.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘tiger’ defined in file [/SpringBootBean/target/classes/com/yawintutor/Tiger.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name ‘lion’: Requested bean is currently in creation: Is there an unresolvable circular reference?

If the root cause exception is displayed as Requested bean is currently in creation then follow the link below to resolve this exception.

BeanCurrentlyInCreationException: Error creating bean with name: Requested bean is currently in creation

NoUniqueBeanDefinitionException: No qualifying bean of type available: expected single matching bean but found

This exception occurs when the bean is auto-wired that matches two or more loaded beans in the spring boot application context.

s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘zoo’: Unsatisfied dependency expressed through field ‘animal’; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type ‘com.yawintutor.Animal’ available: expected single matching bean but found 2: lion,tiger

If the root cause exception is displayed as expected single matching bean but found then follow the link below to resolve this exception.

NoUniqueBeanDefinitionException: No qualifying bean of type available: expected single matching bean but found

BeanInstantiationException: Failed to instantiate: No default constructor found

If the default constructor is not found while auto-wiring the bean, the exception below will be thrown.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘department’ defined in file [SpringBootBean/target/classes/com/yawintutor/Department.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.yawintutor.Department]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.yawintutor.Department.

If the root cause exception is displayed as No default constructor found then follow the link below to resolve this exception.

BeanInstantiationException: Failed to instantiate: No default constructor found

BeanInstantiationException: Failed to instantiate: Constructor threw exception

If the default constructor throws an exception while auto-wiring the bean, the exception below will be thrown.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘department’ defined in file [/SpringBootBean/target/classes/com/yawintutor/Department.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.yawintutor.Department]: Constructor threw exception; nested exception is java.lang.NullPointerException

If the root cause exception is displayed as Constructor threw exception then follow the link below to resolve this exception.

BeanInstantiationException: Failed to instantiate: Constructor threw exception

BeanInstantiationException: Failed to instantiate: Factory method threw exception

If the bean is not available, try to create and load using the abstract class name and bean factory. The beans are not going to instantiate. In this case, the exception below will be thrown.

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘animal’ defined in class path resource [com/yawintutor/SpringConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.yawintutor.AbstractAnimal]: Factory method ‘animal’ threw exception; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named ‘abstractAnimal’ available

If the root cause exception is displayed as Factory method threw exception then follow the link below to resolve this exception.

BeanInstantiationException: Failed to instantiate: Factory method threw exception

If you find some other type of BeanCreationException, please add it to the comments section, we will provide you with the solution.

Источник

Bitbucket Support

Knowledge base

Products

Jira Software

Project and issue tracking

Jira Service Management

Service management and customer support

Jira Work Management

Manage any business project

Confluence

Bitbucket

Git code management

Resources

Documentation

Usage and admin help

Answers, support, and inspiration

Suggestions and bugs

Feature suggestions and bug reports

Marketplace

Billing and licensing

Frequently asked questions

Viewport

Confluence

SpringMVC dispatcher could not be started

Related content

Still need help?

The Atlassian Community is here for you.

Problem

Bitbucket Server fails to startup.

The following message is displayed on the UI:

There are different root causes for this problem.

Cause #1:
The following exception is reported in the atlassian-bitbucket.log file:

In this case, /var/atlassian/application-data/bitbucket/ , which is being used as Bitbucket Server Home Directory, is not accessible to the user running Bitbucket Server. The permissions on the directories contained within might be mixed where the user running Bitbucket Server is not the same.

Cause #2:
The following exception is reported in the atlassian-bitbucket.log file:

In this case, the database used by Bitbucket Server is unavailable.

Cause#3

The following exception is reported in atlassian-bitbucket.log

This is caused by using an incompatible MySQL connector 8, whereas Bitbucket accepts only 5.1x

Cause #4
The following exceptions are seen in atlassian-bitbucket.log

In this case, underlying Java JVM couldn’t understand the parameter jdk.disabled.namedCurves and fails to start the service.

Cause #5
The following exceptions are seen in atlassian-bitbucket.log

Resolution

These are the resolutions for the root causes above:

    Resolution for cause #1:

Ensure the user has sufficient read/write/execute permissions on the above folder and restart the application.

For the example above, the following commands were run:

Источник

Возникла такая ошибка
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘liquibase’ defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ChangeLogParseException: databaseChangeLog does not contain a list of entries. Each changeSet must begin ‘ — changeSet:’
вот такой у меня файл changelog-master.yml

databaseChangeLog:
 include:
  file: liquibase/scripts/create_faculty_name_color_index.sql

а вот файл самого скрипта

--liquibase formatted sql

--changeset author:id1
CREATE TABLE users1 (
                       id SERIAL,
                       email TEXT
)

Я прочитал инструкцию
сделал прямо как в первоначальном скриншоте

Best Practices


Можете подсказать что не так?

Понятно, что он у меня ругается, что типа у меня нет — changeSet. Я пробовал добавлять это в yml файл, но тогда он вообще не читался. Я попробовал по-разному .
Вот мой репозиторий
https://github.com/Dimarik1Krasnodar93/skypro_kurs1

Views: 13,517

In the previous post, I showed you how to use database migration with Liquibase in Spring MVC. So what about Spring Boot? In this tutorial, I will show you how to do this! It’s really simple!

First, I will create a new Spring Boot project:

Using Liquibase in Spring Boot application

with Liquibase Migration, Spring Data JDBC and PostgreSQL dependencies as follows:

Using Liquibase in Spring Boot application

The purpose I use Spring Data JDBC is to configure the dataSource for Liquibase and I will use PostgreSQL for this tutorial.

Result:

Using Liquibase in Spring Boot application

If you pay attention, you will see that the Spring Starter Project in the Spring Tool Suite has generated the src/main/resources/db/changelog directory. This is the directory containing the changelog file of Liquibase.

As you all know, for Liquibase to work, we need to declare the dataSource and the path to the changelog file, so now we will define them one by one.

We will define the dataSource information for Liquibase in the application.properties file.

spring.datasource.url=jdbc:postgresql://localhost:5432/liquibase_example

spring.datasource.username=khanh

spring.datasource.password=1

If you run this application now, you will see the following error:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

  .   ____          _            __ _ _

/ / ___‘_ __ _ _(_)_ __  __ _

( ( )___ | ‘_ | ‘_| | ‘_ / _` |

/  ___)| |_)| | | | | || (_| |  ) ) ) )

  ‘  |____| .__|_| |_|_| |___, | / / / /

=========|_|==============|___/=/_/_/_/

:: Spring Boot ::                (v2.4.5)

2021-05-13 05:54:48.936  INFO 79548 — [           main] c.h.s.SpringBootLiquibaseApplication     : Starting SpringBootLiquibaseApplication using Java 15.0.1 on Khanhs-MacBook-Pro.local with PID 79548 (/Users/khanh/Documents/workspace-spring-tool-suite-4-4.9.0.RELEASE/spring-boot-liquibase/target/classes started by khanh in /Users/khanh/Documents/workspace-spring-tool-suite-4-4.9.0.RELEASE/spring-boot-liquibase)

2021-05-13 05:54:48.938  INFO 79548 — [           main] c.h.s.SpringBootLiquibaseApplication     : No active profile set, falling back to default profiles: default

2021-05-13 05:54:49.238  INFO 79548 — [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JDBC repositories in DEFAULT mode.

2021-05-13 05:54:49.244  INFO 79548 — [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 4 ms. Found 0 JDBC repository interfaces.

2021-05-13 05:54:49.457  INFO 79548 — [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 — Starting…

2021-05-13 05:54:49.607  INFO 79548 — [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 — Start completed.

2021-05-13 05:54:50.904  INFO 79548 — [           main] l.lockservice.StandardLockService        : Successfully acquired change log lock

2021-05-13 05:54:50.932  INFO 79548 — [           main] l.lockservice.StandardLockService        : Successfully released change log lock

2021-05-13 05:54:50.935  WARN 79548 — [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization — cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘liquibase‘ defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ChangeLogParseException: Error parsing classpath:/db/changelog/db.changelog-master.yaml

2021-05-13 05:54:50.935  INFO 79548 — [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 — Shutdown initiated…

2021-05-13 05:54:50.939  INFO 79548 — [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 — Shutdown completed.

2021-05-13 05:54:50.949  INFO 79548 — [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug‘ enabled.

2021-05-13 05:54:50.964 ERROR 79548 — [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************

APPLICATION FAILED TO START

***************************

Description:

Liquibase failed to start because no changelog could be found at ‘classpath:/db/changelog/db.changelogmaster.yaml.

Action:

Make sure a Liquibase changelog is present at the configured path.

By default, Spring Boot will read the Liquibase changelog file defined in the YAML file, in the src/main/resouces/db/changelog/ directory, named db.changelog-master.yaml. You can change this default configuration using property spring.liquibase.change-log.

I will define a changelog file with XML format in the directory src/main/resources/db/changelog with the following content:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

<?xml version=«1.0» encoding=«UTF-8»?>

<databaseChangeLog

xmlns=«http://www.liquibase.org/xml/ns/dbchangelog»

xmlns:xsi=«http://www.w3.org/2001/XMLSchema-instance»

xsi:schemaLocation=«http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.0.xsd»>

<changeSet id=«1» author=«khanh»>

<preConditions onFail=«MARK_RAN»>

<not>

<tableExists tableName=«clazz» />

</not>

</preConditions>

<createTable tableName=«clazz»>

<column name=«id» type=«BIGINT» autoIncrement=«true»>

<constraints primaryKey=«true» nullable=«false» />

</column>

<column name=«name» type=«VARCHAR(50)» />

</createTable>

</changeSet>

</databaseChangeLog>

Configure the spring.liquibase.change-log property in the application.properties file:

spring.liquibase.changelog=classpath:db/changelog/dbchangelog.xml

Now, run the application again, check the database, you will see the following results:

Using Liquibase in Spring Boot application

Hi,
I’m also running into this issue, I use liquibase maven plugin. I’m trying to upgrade from 3.5.3 to latest 4.3.2.
my apache maven is at 3.6.0. JDK was 1.8, downloaded jdk 11 still having issues running liquibase maven under ubuntu linux environment.
all my legacy xml scripts changeSet’s use logicalFilePath my sqlFile’s use relativeToChangelogFile=»true» my sqlfile path’s look like
<sqlFile path="./some_filename.sql" stripComments="false" splitStatements="true" encoding="utf8" endDelimiter="n/" relativeToChangelog="true"/>

my legacy scripts still work with liquibase maven plugin up to 3.10.3.
so far I haven’t found any liquibase maven plugin above 4.x that work without any other changes described below.
but I only tried a few in 4.x

the only workaround I’ve found is a bit of a nuisance

the command line I had to add resources:resources
mvn resources:resources liquibase:update ...

and change path, and relativeToChangelog to the following

<sqlFile path="classpath:/liquibase/db/changelog/V001/some_filename.sql" stripComments="false" splitStatements="true" encoding="utf8" endDelimiter="n/" relativeToChangelog="false"/>

under my resources folder -> src/main/resources
full relative path to the sql file is ./liquibase/db/changelog/V001

mvn resources:resources run at project directory level copies all files
under
src/main/resources
to
target/classes

with relativeToChangelog now set to «false» and sqlFile path changed to classpath path format only, can liquibase maven plugin above 4.x find my files now with this path shown below, I believe the files are being found under target/classes folder.
classpath:/liquibase/db/changelog/V001/some_filename.sql

using linux relative path ./liquibase/db/changelog/V001/some_filename.sql did not work with relativeToChangelog set to «false»

So far it seems this is a bug introduced in liquibase maven plugin 4.x and higher. it looks like the bug fix 1277 Pull Request 1480 back in October never got merged to Liquibase 4.1.1 and above.

Error creating bean with name ‘liquibase’ in Spring Boot App

I have difficulties with adding Liquibase to my existing Spring Boot application.

I added the necessary dependency in pom.xml. Then I have added an empty changelog-master.xml file
Here is the code:

<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog

http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd”>

But when I run the program I got an exception:

Error creating bean with name ‘liquibase’ defined in class path resource [org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration$LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.ChangeLogParseException: Error Reading Migration File: class path resource [db/changelog/changelog-master.xml] cannot be resolved to URL because it does not exist

Could anyone suggest some actions?

Advertisement

Answer

you should add path to your changelog file in application.yml

for example:

spring:
  liquibase:
    change-log: classpath:db/changelog/db.changelog-master.xml

and you should create valid empty changelog:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
        xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">


</databaseChangeLog>

8 People found this is helpful

У меня есть эта неприятная ошибка при запуске Embedded Tomcat в моем проекте jHipster. Провел много времени, пытаясь разрешить это, но не может понять, почему это происходит. Это началось после обновления проекта от главного редактора, но я также внедрил Custom Repository.

Трассировки стека:

    DEBUG] uk.co.
config.DatabaseConfiguration - Configuring Liquibase
[WARN] org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered d
uring context initialization - cancelling refresh attempt
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquibase' defined in class path
 resource [uk/co/inspiresoft/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is
liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          classpath:config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster is now: 7:bde
7b076d47aefe8278d126cde26b172

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1574) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:539) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spr
ing-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:230) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[sprin
g-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-
beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListable
BeanFactory.java:755) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplic
ationContext.java:757) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~
[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext
.java:118) [spring-boot-1.2.3.RELEASE.jar:1.2.3.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686) [spring-boot-1.2.3.RELEASE.jar
:1.2.3.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320) [spring-boot-1.2.3.RELEASE.jar:1.2
.3.RELEASE]
        at uk.co.Application.main(Application.java:59) [classes/:na]
Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          classpath:config/liquibase/changelog/00000000000000_initial_schema.xml::00000000000001::jhipster is now: 7:bde
7b076d47aefe8278d126cde26b172

        at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:196) ~[liquibase-core-3.3.2.jar:na]
        at liquibase.Liquibase.update(Liquibase.java:196) ~[liquibase-core-3.3.2.jar:na]
        at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:353) ~[liquibase-core-3.3.2.j
ar:na]
        at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:317) ~[liquibase-core-3.
3.2.jar:na]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowi
reCapableBeanFactory.java:1633) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1570) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
        ... 13 common frames omitted
[INFO] uk.co.config.CacheConfiguration - Closing Cache Manager
[INFO] com.hazelcast.core.LifecycleService - [192.168.1.48]:5701 [dev] [3.4] Address[192.168.1.48]:5701 is SHUTTING_DOWN

Это мой DatabaseConfiguration.class

    import java.util.Arrays;

import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import liquibase.integration.spring.SpringLiquibase;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.ApplicationContextException;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.codahale.metrics.MetricRegistry;
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

@Configuration
@EnableJpaRepositories(repositoryFactoryBeanClass=uk.co.repository.IRepositoryFactoryBean.class, basePackages={"uk.co.repository"})
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
@EnableTransactionManagement
public class DatabaseConfiguration implements EnvironmentAware {

    private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);

    private RelaxedPropertyResolver propertyResolver;

    private Environment env;

    @Autowired(required = false)
    private MetricRegistry metricRegistry;

    @Override
    public void setEnvironment(Environment env) {
        this.env = env;
        this.propertyResolver = new RelaxedPropertyResolver(env, "spring.datasource.");
    }

    @Bean(destroyMethod = "shutdown")
    @ConditionalOnMissingClass(name = "uk.co.config.HerokuDatabaseConfiguration")
    @Profile("!" + Constants.SPRING_PROFILE_CLOUD)
    public DataSource dataSource() {
        log.debug("Configuring Datasource");
        if (propertyResolver.getProperty("url") == null && propertyResolver.getProperty("databaseName") == null) {
            log.error("Your database connection pool configuration is incorrect! The application" +
                    "cannot start. Please check your Spring profile, current profiles are: {}",
                    Arrays.toString(env.getActiveProfiles()));

            throw new ApplicationContextException("Database connection pool is not configured correctly");
        }
        HikariConfig config = new HikariConfig();
        config.setDataSourceClassName(propertyResolver.getProperty("dataSourceClassName"));
        if (propertyResolver.getProperty("url") == null || "".equals(propertyResolver.getProperty("url"))) {
            config.addDataSourceProperty("databaseName", propertyResolver.getProperty("databaseName"));
            config.addDataSourceProperty("serverName", propertyResolver.getProperty("serverName"));
        } else {
            config.addDataSourceProperty("url", propertyResolver.getProperty("url"));
        }
        config.addDataSourceProperty("user", propertyResolver.getProperty("username"));
        config.addDataSourceProperty("password", propertyResolver.getProperty("password"));

        if (metricRegistry != null) {
            config.setMetricRegistry(metricRegistry);
        }
        return new HikariDataSource(config);
    }

    @Bean
    public SpringLiquibase liquibase(DataSource dataSource) {
        SpringLiquibase liquibase = new SpringLiquibase();
        liquibase.setDataSource(dataSource);
        liquibase.setChangeLog("classpath:config/liquibase/master.xml");
        liquibase.setContexts("development, production");
        if (env.acceptsProfiles(Constants.SPRING_PROFILE_FAST)) {
            if ("org.h2.jdbcx.JdbcDataSource".equals(propertyResolver.getProperty("dataSourceClassName"))) {
                liquibase.setShouldRun(true);
                log.warn("Using '{}' profile with H2 database in memory is not optimal, you should consider switching to" +
                    " MySQL or Postgresql to avoid rebuilding your database upon each start.", Constants.SPRING_PROFILE_FAST);
            } else {
                liquibase.setShouldRun(false);
            }
        } else {
            log.debug("Configuring Liquibase");
        }
        return liquibase;
    }

    @Bean
    public Hibernate4Module hibernate4Module() {
        return new Hibernate4Module();
    }

    @Bean
    public EntityManagerFactory entityManagerFactory() {

      HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
      vendorAdapter.setGenerateDdl(true);

      LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
      factory.setJpaVendorAdapter(vendorAdapter);
      factory.setPackagesToScan("uk.co.repository");
      factory.setDataSource(dataSource());
      factory.afterPropertiesSet();

      return factory.getObject();
    }
}

Понравилась статья? Поделить с друзьями:
  • Beamng drive runtime error
  • Bdw 45 106 коды ошибок
  • Beamng drive error 8007000e
  • Bdo ошибка 30005
  • Bdo как изменить фамилию