Сообщения

MS Lesson13: Proxy Design Pattern, ACID & Transaction

Proxy Design Pattern Proxy - it provides an object that acts as substitute for a real service object used by a client. A proxy receives client requests, does some work and then passes the request to a original object.  package guru.springframework.cruddemo.proxy; public interface DailySession { void attendLesson (); } package guru.springframework.cruddemo.proxy; import lombok. AllArgsConstructor ; import lombok. Data ; import lombok. NoArgsConstructor ; import java.util.Date; @Data @NoArgsConstructor @AllArgsConstructor public class Attendance { private Date date ; private boolean isPresent ; } package guru.springframework.cruddemo.proxy; import lombok. Data ; @Data public class Student implements DailySession { private final Attendance attendance ; public Student (Attendance attendance) { this . attendance = attendance; } @Override public void attendLesson () { System. out .println( "Attending the session..." ); } } package...

MS Lesson ?: Spring Security

  1. Ilkin olaraq sade Spring Security-ye cavab veren klas budur: /* * Copyright 2012-present the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.boot.security.autoconfigure; import java.util.ArrayList; import java.util.List; import java.util.UUID; import org.springframework.boot.context.properties. ConfigurationProperties ; import org.springframework.util.StringUtils; /** * Configuration properties for...

MS Lesson12: LazyInitializationException, n + 1 problem

1. LazyInitializationException Hibernate session/persistence context artiq baglidirsa Hibernate child-i yukleye bilmir ve LazyInitializationException atir.  package guru.springframework.cruddemo.entity; import jakarta.persistence.CascadeType; import jakarta.persistence. Column ; import jakarta.persistence. Entity ; import jakarta.persistence.FetchType; import jakarta.persistence. GeneratedValue ; import jakarta.persistence.GenerationType; import jakarta.persistence. Id ; import jakarta.persistence. OneToMany ; import jakarta.persistence. OneToOne ; import jakarta.persistence. Table ; import lombok. AllArgsConstructor ; import lombok. Builder ; import lombok. Getter ; import lombok. NoArgsConstructor ; import lombok. Setter ; import lombok. ToString ; import java.util.ArrayList; import java.util.List; @Getter @Setter @Entity @Builder @ToString @NoArgsConstructor @AllArgsConstructor @Table (name = "persons" ) public class Person { @Id @GeneratedValue (strategy = Generat...