[SpringBoot] Bean
·
Web & Android/SpringBoot
💡 스프링 컨테이너에서 관리하는 자바 객체 Bean Scope 빈이 존재할 수 있는 범위를 뜻함 종류 싱글톤(Singleton) 기본 스코프, 스프링 컨테이너의 시작과 종료까지 유지되는 가장 넓은 범위의 스코프 스프링 컨테이너에서 한 번 생성됨 컨테이너가 사라질 때 bean도 제거됨 프로토타입(Prototype) 모든 요청에서 새로운 객체를 생성하는 것 스프링 컨테이너는 프로토타입 빈의 생성과 의존관계 주입까지만 관여하고 더는 관리하지 않는 매우 짧은 범위의 스코프 웹 관련 스코프 request : 웹 요청이 들어오고 나갈 때까지 유지되는 스코프 session : 웹 세션이 생성되고 종료될 때까지 유지되는 스코프 application : 웹의 서블릿 컨텍스트와 같은 범위로 유지되는 스코프
[SpringBoot] 스케줄링
·
Web & Android/SpringBoot
💡 ScheduledExecutorService과 SpringBoot의 @Scheduled로 스케줄링을 설정할 수 있다. ScheduledExecutorService은 인수있는 메서드에도 적용할 수 있지만 @Scheduled는 인수있는 메서드에 적용이 불가하다. ScheduledExecutorService Java 1.5부터 지원되는 스케줄링이 가능한 Executor 서비스로 인터페이스이며, 구현체로 ScheduledThreadPoolExecutor()가 있다. 예제 코드 @Service @RequiredArgsConstructor @Transactional public class BattleRivalService { private final BattleRepository battleRepository;..
[Flutter] 유용한 패키지들
·
Web & Android/Flutter
photo_view https://pub.dev/packages/photo_view Pinch 제스쳐라고 해서 손가락 두개 이용해서 사진을 줌인 하고 싶으면 씀 기본적인 갤러리, 캐러셀 UI도 쉽게 쓸 수 있게 제공 simple_animations https://pub.dev/packages/simple_animations (예시) https://github.com/felixblaschke/simple_animations/blob/main/example/example.md#stateless-animation 플러터에서 기본 기능만으로 애니메이션을 만들려면 대부분 StatefulWidget, Animation, Tween, Controller가 필요 귀찮으면 위젯 하나로 이거 다 해결할 수 있는 패키지를 ..
[Flutter] 반응형 스크린 사이즈
·
Web & Android/Flutter
현재 기기의 스크린 사이즈 출력하고 싶은 경우 MediaQuery.of(context).size.width; //폭 (LP단위) MediaQuery.of(context).size.height; //높이 (LP단위) MediaQuery.of(context).padding.top; //기기의 상단바 부분 높이 (LP단위) MediaQuery.of(context).devicePixelRatio; //이 기기는 1LP에 픽셀이 몇개 들어있는지 화면 폭에 따라 위젯을 다르게 보여주고 싶은 경우 MediaQuery.of(context).size.width < 600 ? Home() : 큰화면에서보여줄다른위젯() 화면 폭에 따라 스타일 변경하고 싶은 경우 Text( '글자임', style: TextStyle( fon..
[Flutter] notification 알림 주는 법
·
Web & Android/Flutter
Notification push notification - 서버에서 보내는 알림 local notification - 앱 자체에서 실행하는 알림 패키지 설치 pubspec.yaml에 flutter_local_notifications: ^9.1.5 추가 후 pub get Android 셋팅 android/app/src/main/res/drawable 폴더에 알림에 띄울 아이콘 용 넣기 흰색 아웃라인만 있는 .png만 허용 iOS 셋팅 프로젝트 내의 ios/Runner/AppDelegate.swift 파일에 코드 추가 GeneratedPluginRegistrant.register(with: self) 이런 코드 윗줄에 복붙 if #available(iOS 10.0, *) { UNUserNotification..
[Flutter] GridView, CustomScrollView 프로필 페이지 만들기
·
Web & Android/Flutter
GridView 격자 레이아웃 grid가 몇개 생성될지 미리 알고 있으면 GridView.count 쓰고 grid가 몇개 생성될지 아직 모르겠으면 GridView.builder GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2 ), itemCount: list자료.length, itemBuilder: (c, i) { return Container(color : Colors.grey); } ), itemCount : 개수 gridDelegate : 가로로 보여질 개수 예제 body: GridView.builder( gridDelegate: SliverGridDelegateWithFixedCr..