Skip to content

Commit

Permalink
YEL-214 [setting] spring batch setting
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonjeongs committed Feb 26, 2024
1 parent 7145470 commit 4447168
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ dependencies {
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'org.springframework.batch:spring-batch-test'

// jwt decode
implementation 'org.bouncycastle:bcprov-jdk15on:1.69'
Expand All @@ -109,6 +110,10 @@ dependencies {
// tink
implementation 'com.google.crypto.tink:tink-android:1.4.0-rc1'
implementation 'com.google.crypto.tink:apps-rewardedads:1.10.0'

// spring batch
implementation 'org.springframework.boot:spring-boot-starter-batch'

}

asciidoctor {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/yello/server/ServerApplication.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package com.yello.server;

import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;


@SpringBootApplication
@ConditionalOnMissingBean(value = DefaultBatchConfiguration.class, annotation = EnableBatchProcessing.class)
public class ServerApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,7 @@ List<User> findAllByOtherGroupContainingYelloId(@Param("groupName") String group
@Query("select u from User u "
+ "where LOWER(u.name) like LOWER(CONCAT('%', :name, '%'))")
Page<User> findAllByNameContaining(Pageable pageable, @Param("name") String name);

Page<User> findAllByPageable(Pageable pageable);

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@ List<User> findAllByOtherGroupContainingYelloId(String groupName, String keyword
Page<User> findAllByNameContaining(Pageable pageable, String name);

void delete(User user);

Page<User> findAllByPageable(Pageable pageable);
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,9 @@ public Page<User> findAllByNameContaining(Pageable pageable, String name) {
public void delete(User user) {
userJpaRepository.delete(user);
}

@Override
public Page<User> findAllByPageable(Pageable pageable) {
return userJpaRepository.findAllByPageable(pageable);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -321,4 +321,13 @@ public Page<User> findAllByNameContaining(Pageable pageable, String name) {
public void delete(User user) {
data.remove(user);
}

@Override
public Page<User> findAllByPageable(Pageable pageable) {
final List<User> userList = data.stream()
.skip(pageable.getOffset())
.limit(pageable.getPageSize())
.toList();
return new PageImpl<>(userList);
}
}

0 comments on commit 4447168

Please sign in to comment.