JEE CDI Integration

Liquibase can be run in a JEE CDI environment by implementing a number of CDI Producer methods. The CDI Liquibase integration is a simple CDI extension that performs a Liquibase update when the CDI container boots.

How to Configure Liquibase

 * A Simple CDI Producer to configure the CDI Liquibase integration
public  class  LiquibaseProducer  {  

    private  DataSource  myDataSource;  

    @Produces  @LiquibaseType  
    public  CDILiquibaseConfig  createConfig()  {  
        CDILiquibaseConfig  config  =  new  CDILiquibaseConfig();  
        return  config;  

    @Produces  @LiquibaseType  
    public  DataSource  createDataSource()  throws  SQLException  {  
        return  myDataSource;  

    @Produces  @LiquibaseType  
    public  ResourceAccessor  create()  {  
        return  new  ClassLoaderResourceAccessor(getClass().getClassLoader());  


CDILiquibaseConfig Available Attributes

  • changelog
  • contexts
  • parameters
  • defaultSchema
  • dropFirst since 2.0.2

If you don't want Liquibase to run you can configure the following system property: