https://spacy.io/usage/spacy-101
https://scikit-learn.org/stable/install.html
https://www.tabnine.com/code/java/methods/org.springframework.data.redis.core.RedisTemplate/opsForSet
https://springframework.guru/exception-handling-in-spring-boot-rest-api/
steps for create spring batch application
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
public class MyFirstJob implements Tasklet {
@Override
public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {
System.out.println("MyTaskOne start..");
List<Integer> mylist= Arrays.asList(1,2,3,4,5,6,6,67,7,7,7,7);
for(Integer number :mylist){
System.out.println("-------------"+number);
}
// ... your code
System.out.println("MyTaskOne done..");
return RepeatStatus.FINISHED;
}
}
public class MySecondJob implements Tasklet {
@Override
public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception {
List<String>mylist= Arrays.asList("pawan","ravi","mynme");
for(String name: mylist){
System.out.println("name---"+name);
}
return RepeatStatus.FINISHED;
}
}
@Configuration
@EnableBatchProcessing
public class BatchConfig {
@Autowired
private JobBuilderFactory jobs;
@Autowired
private StepBuilderFactory steps;
@Bean
public Step stepOne() {
return steps.get("stepOne")
.tasklet(new MyFirstJob())
.build();
}
@Bean
public Step stepTwo() {
return steps.get("stepTwo")
.tasklet(new MySecondJob())
.build();
}
@Bean
public Job demoJob() {
return jobs.get("demoJob").incrementer(new RunIdIncrementer())
.start(stepOne())
.next(stepTwo())
.build();
}
}
@Configuration
public class AvoidMetadataConfiguration extends DefaultBatchConfigurer {
@Override
protected JobRepository createJobRepository() throws Exception {
MapJobRepositoryFactoryBean factoryBean = new MapJobRepositoryFactoryBean();
factoryBean.afterPropertiesSet();
return factoryBean.getObject();
}
}
@Component
public class SpringJobSchedular {
@Autowired
JobLauncher jobLauncher;
@Autowired
Job job;
@Scheduled(cron = "* 0/1 * * * ?")
public void perform() throws Exception
{
System.out.println("------------------myjob in ----------------------");
JobParameters params = new JobParametersBuilder()
.addString("JobID", String.valueOf(System.currentTimeMillis()))
.toJobParameters();
jobLauncher.run(job, params);
System.out.println("------------------myjob in ----------------------");
}
}
1. Create docker file
Dockerfile
FROM openjdk
COPY ./target/myservice-0.0.1-SNAPSHOT.jar /usr/app/
WORKDIR /usr/app
RUN sh -c 'touch myservice-0.0.1-SNAPSHOT.jar'
EXPOSE 8089
ENV spring.profiles.active="local"
2.Create image from docker file
sudo docker build -t mylocalapp:1.0 .
mylocalapp is image name
1.0 is tag
3.Create container from image
sudo docker run -d -p 9090:80 --name pawancontainer mylocalapp:1.0
pawancontainer is container name
mylocalapp:1.0 is image name and 1.0 is tag name
4.sudo docker ps -a
list of all container