Class DataServiceImpl

java.lang.Object
com.alpaca.service.impl.DataServiceImpl
All Implemented Interfaces:
DataService

@Service public class DataServiceImpl extends Object implements DataService
Service responsible for seeding essential application data upon startup.

Implements DataService and initializes default permissions, roles, users, and profiles. Listens for ApplicationReadyEvent to trigger post-startup actions, such as warming up caches or validating system readiness.

This ensures the application is populated with baseline data when it starts in a clean state.

See Also:
  • Field Details

  • Constructor Details

    • DataServiceImpl

      public DataServiceImpl()
  • Method Details

    • initializeData

      @Transactional public void initializeData()
      Seeds the database with default permissions, roles, users, and profiles, only if no user records already exist.

      Marked Transactional to ensure atomicity and rollback safety.

      Specified by:
      initializeData in interface DataService
    • warmUpHibernate

      @EventListener(org.springframework.boot.context.event.ApplicationReadyEvent.class) public void warmUpHibernate()
      Invoked after the application is fully initialized and ready to serve requests. Triggers a base call to preload roles and logs system readiness.

      Using EventListener with ApplicationReadyEvent ensures this runs only once the Spring context is fully set up.