This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.core.platform.mapper; | |
import com.core.platform.entity.EntityType; | |
import com.core.platform.model.Model; | |
public interface Mapper<TModel extends Model, TEntity extends EntityType> { | |
TEntity modelToEntity(TModel model); | |
TModel entityToModel(TEntity entity); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void lazyEvaluate() { | |
List<Integer> numbers = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); | |
long count = numbers.stream() | |
.filter(n -> { | |
System.out.println("Filtering: " + n); | |
return n % 2 == 0; | |
}) | |
.map(n -> { | |
System.out.println("Mapping: " + n); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void test() { | |
List<String> words = Arrays.asList("apple", "banana", "cherry", "date", "elderberry"); | |
// Declare a Stream that filters words starting with the letter 'a' | |
Stream<String> filteredWords = words.stream().peek(System.out::println).filter(word -> word.startsWith("a")); | |
filteredWords.forEach(System.out::println); | |
boolean isValidate = filteredWords.count() > 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.core.platform.config; | |
import org.springframework.boot.autoconfigure.flyway.FlywayProperties; | |
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.context.annotation.Primary; | |
import java.util.HashMap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Service; | |
import org.springframework.web.client.RestTemplate; | |
@Service | |
public class AuthService { | |
private final RestTemplate customRestTemplate; | |
@Autowired | |
public AuthService(RestTemplate customRestTemplate) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.demo.controller; | |
import com.example.demo.service.UserService; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
@RestController | |
public class AuthController { |