Posts
Interface Segregation
- Get link
- Other Apps
jjjj interface Vehicle { void dive () ; void fly () ; } class Car implements Vehicle { @Override public void dive () {System. out .println( "InterfaceSegregation.Car dive" ) ; } @Override public void fly () { //This not needed to a bike } } Fixing That issue.. interface DrivingVehicle { void dive () ; } interface FlyingVehicle { void fly () ; } class Car implements DrivingVehicle { @Override public void dive () {System. out .println( "InterfaceSegregation.Car dive" ) ; } } class Plane implements DrivingVehicle , FlyingVehicle { @Override public void dive () {System. out .println( "InterfaceSegregation.Plane dive" ) ; } @Override public void fly () {System. out .println( "InterfaceSegregation.Plane fly" ) ; } } class PetrolEngine{} class Vehicle{ private PetrolEngine engine ; Vehicle (PetrolEngine engine){ this . engine =engine ; } } Fixing that issue. interface Engine{} class PetrolEngine implements
01.Job Scheduler - Project creation
- Get link
- Other Apps
Jo b Scheduler - Project Creation This is implementing using two ways. 1.Using @Scheduler annotation. 2.Using Quartz scheduler (In the previous example, we executed scheduled tasks, but at the same time, we could not dynamically set the start time of the job, or pass parameters to it. To solve these problems, you can directly use Quartz.) Quartz dependency is not necessary to implement Scheduler. This has been added for future Quartz project implementation. Using @Scheduler Need to add @EnableScheduling to main class. @SpringBootApplication @EnableScheduling public class JobScheduleApplication { public static void main (String[] args) { SpringApplication. run (JobScheduleApplication. class, args) ; } } This is a simple scheduler class. @Component public class SchedulerTest { @Scheduled (cron = "0/5 * * * * ?" ) public void everyFiveSeconds () { System. out .println( "Scheduler Executed.EveryFiveSeconds Scheduler: " + new Date()) ;
01.Database Migration - Introduction
- Get link
- Other Apps
Database Migration GitHub Link For Sample Project: https://github.com/LahiruPriyankara/Liquibase https://github.com/LahiruPriyankara/flyway Git වැනි version control system වලදී code changes history එකක maintain වන අතර එම නිසා කවුද ඒ ඒ changes කලේ කොයිකාලේද කලේ වගේ full history එකක් බලාගන්න පුලුවන් . ඒ වගේම database එකටත් කරන වෙනස්කම් track කරලා තියාගන්න ඕනේ වෙනවනම් එකට use වන version control system තිබෙන අතර flyway, liquibase යනු එවැනි version control system දෙකක් වේ . Database schema changes track කරගන තියන open source version control application එකකි .Any changes which we do with data base scheme will be track and save in flywayschamahistory table in flyway and databasechangelog table in liquibase. Liquibase or flyway is an open-source database-independent library for tracking, managing and applying database schema changes. Advantage Database independent Automatic update (When application up, Changes will be automatically applied.) Automatic creati
02.Job Scheduler - Cron Job Time Pattern
- Get link
- Other Apps
Jo b Scheduler - Cron Job Time Pattern Now understand the cron pattern(* * * * * *). Guiding Tutorial: https://productresources.collibra.com/docs/collibra/latest/Content/Cron/co_spring-cron.htm <second> <minute> <hour> <day_of_month> <month> <day_of_week> , - * / , - * / , - * / , - * ? / L W , - * / , - * ? / L # 0-59 0-59 0-23 1-31 1-12 JAN-DEC 0-7(where 0 is MON)MON-SUN Position Field Allowed Values Allowed Special characters Examples 1 Second 0-59 , - * / 01) 10 = At 10th second. 02) */10 = every 10 seconds. 2 Minutes 0-59 , - * / 01) 30 = at the 30th minute. 02) */15 = every 15 minutes. 03) 5/10 = every 10 minutes starting at the 5th minute after the hour 3 Hours 0-23 , - * / 01) 10 = at 10 o'clock. 02) 8-10 = at 8,9 and 10 AM. 03) 6,18 = at 6 AM and at 6 PM. 4 Days of Month 1-31