Savollar - Spring Framework Uz
368 subscribers
199 photos
193 links
😊 Hech qachon izlanishdan to'xtamang!
Download Telegram
#savol_21 #javob_berildi
Assalomu alaykum. Savol bor edi. Tizimdagi userga notification jo`natiladi va u bazaga saqlanadi. U user shu xabarni ko`rganidan ma'lum vaqt o`tgandan so`ng shu saqlangan xabarni qanday o`chirib yuborsa bo`ladi? @Scheduled dan foydalanmagan holda
Savol muallifi: JALOLIDDIN
..........................................................
Javob: Userga notification jo'natilgandan keyin, o'sha message ni ko'rilgan ko'rilmagan degan qiymati bo'ladi. Userga jo'natilsa va ko'rilsa message ni o'sha vaqtning o'zida ko'rilgan sifatida belgilab, o'chirib yuborasiz. Yoki bitta thread yozib qo'yasiz va o'sha ko'rilgan messagelarni o'chirib ketaverasiz doimiy.
Javob muallifi: Boburshox👑 Norboyev
izohdagi javob linki

...................................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_22 #javob_berildi
Dockerda java app kutarilgan containerda , postgres bn redis ham bor ular ham alohidacontainerlarda postgresni connect qilishda postgres hostiga postgres container nameni berganman ishlayapdi ln redisda connect qilolmayapdi , hostiga quyganda .


````
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:messages");
messageSource.setDefaultEncoding("UTF-8");
return messageSource;
}

@Bean
JedisConnectionFactory jedisConnectionFactory() {
JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory();
jedisConnectionFactory.setHostName("redis_host");
jedisConnectionFactory.setPort(6379);
jedisConnectionFactory.setUsePool(true);
jedisConnectionFactory.getPoolConfig().setMaxIdle(30);
jedisConnectionFactory.getPoolConfig().setMinIdle(0);
return new
#savol_23 #javob_berildi
Assalomu alaykum. postmanda date ni qanaqa tartibda berish kere. masalan mahsulot yaroqlilik muddatini.
Savol muallifi: Coder98
..........................................................
Javob: Default holatda yyyy.MM.dd bulishi kerak without timestamp bulsa siz qandaydir uziz formatini uzgartirmagan bulsangiz
Javob muallifi: Shoxzod Ravshanov
izohdagi javob linki

..........................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_24 #javob_berildi
Error response from daemon: Ports are not available: listen tcp 0.0.0.0:2181: bind: An attempt was made to access a sock
et in a way forbidden by its access permissions.
Savol muallifi: Mus'ab
Rasm 1

..........................................................
Javob: https://github.com/docker/for-win/issues/9272
Javob muallifi: Boburshox👑 Norboyev
izohdagi javob linki

...............................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_25 #javob_berildi
Assalom aleylum savolim bor edi,
@JoinColumn annotatsiyasini vazifani columga nom qotish uchun lekin uni ishlatmasa ham ozi nomi bn yoziladiku, unda nima uchun bu annotatsiya bizga kereK
Savol muallifi: .
..........................................................
Javob: buni relation ship da ishlatasiz jadvalingizga boshqa jadvalni boglamoqchi bulsangi. @OneToOne @OneToMany @ManyToOne @ManyToMany larda ishlatasiz vazifasi nom berishingiz mumkin uzingiz , NotNull ni quyishingiz mumkin optional=false desangiz shu ish quyib beradi @Column degan annotatsiya nima vazifa bajarsa bu ham shuni bajaradi faqat bu bog'lanishlar uchun
Javob muallifi: Shoxzod Ravshanov
izohdagi javob linki

.....................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_26 #javob_berildi
Javada Static methodlar non static methodni chaqirolmaydi. LEKIN static void mainda Boshqa non static methodga murojaat qilsam ishlayapti. BU nima degani?.
Savol muallifi: First name
..........................................................
Javob: Non static ga obyekt olib keyin murojaat qilasiz. Main metodda ham boshqa metod static boʻlsagina toʻgʻridan toʻgʻri murojaat boʻladi.
Javob muallifi: Abdulvahid
izohdagi javob linki

................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_27 #javob_berildi
assalomu aleykum, jpa da getById(Long id) methood ihslatsam No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: com.example.gm.entity.AutoShop$HibernateProxy$DgRWvj5r["hibernateLazyInitializer"]) xatolik berayabdi lekin findbyId() orqali get qilsam ishlayabdi, oldin bunday xatolik bo'lmagandi,
Savol muallifi: Sardorbek Matniyazov
..........................................................
Javob: 1. spring.jackson.serialization.fail-on-empty-beans=false
Javob muallifi: Sanjar Suvonov
izohdagi javob linki

...................................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_28 #javob_berildi
Assalomu alaykum databasega connection ololmayapti, nimadan bo'lishi mumkin?
Savol muallifi: Dilnoza Bekmurotova
Rasm 1

..........................................................
Javob: PlSql dan ulanganiga ishonch hosil qiling, success ulansa keyin intelij da ulanib koring
Javob muallifi: Nozimbek Xamidovich
izohdagi javob linki

..........................................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_29 #javob_berildi
Assalomu aleykum hammaga bazada negadur user_id ni id si bilan generatsiya qila olmayapti user_id ruchnoy generatsiya qlib beriladida aslida shunga nima qilsa bo'ladi akalar sequenceId bilan qilsam bo'lyapti
Savol muallifi: Shoxrux
Rasm 1

..........................................................
Javob: cardInfo ni ichida @ManyToOne qilib user bilan bog'lang

yondashuv sal g'alati bopti

ElementCollection asosan elementlar bilan ishlatiladi, entity bilan relationship lar
Javob muallifi: Nozimbek Xamidovich
izohdagi javob linki

.....................................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_30 #javob_berildi
Assalom alaykum, telegram bootni spring bootda qilingan birorta yaxhsiro sitemi yo tutorialmi bormi
Savol muallifi: Temurbek Zarifov
..........................................................
Javob: telegram bot demoqchi bogansiz manimcha

@SaidovSirojiddin akani masterclass da korsatgan videolari bor 1ta variant

havola 👈
Javob muallifi: Shavkat T
izohdagi javob linki

..........................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_31 #javob_berildi
Bean qilib e'lon qilingan classlarni run berganimda yarata olmayapti hammasiga annatatsiyalari quyilgan
Savol muallifi: Shoxzod Ravshanov
..........................................................
Javob: JedisConnectionFactory null kelayotagni uchun propertyda port i va host ini berib quyish kerak ekan
Javob muallifi: Shoxzod Ravshanov
izohdagi javob linki

..................................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_32 #javob_berildi
FAILURE: Build failed with an exception. Bu qanday exception? Spring bootda hali yangiman, bugun ustanovka qilsam manashunaqa exception chiqardi.
Savol muallifi: Feruz
..........................................................
Javob: yuklab olishda qayerdadir failed bo'lgan manimcha, qaytadan project ochib ko'ring !
Javob muallifi: Javohir Temirov
izohdagi javob linki

.................................................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_33 #javob_berildi
Assalomu alaykum.

Savolim RabbitMQ bo'yicha edi.


Spring & RabbitMQ integratsiya qildim, muammo yo'q, shunaqa task berildi message deadletter queue ga tushishi kerak, tushira olmayapmann, consumer da 500 error beradigan ham qilib kordim, barbr deadletter ga tushmasdan kutib turibdi doimiy queue da, max attempt larini kamaytirib ham kordim
Savol muallifi: Temurmalik
..........................................................
Javob: barcha urinishlarda exception bersa o'tadi
Javob muallifi: Jabborov Sherzod
izohdagi javob linki

........................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_34 #javob_berildi
Assalomaleykom bir savol boridi spring securityda jwt tokenli security hamda OAuth2 turlari manimcha kop qollaniladi bulardan qaysibirini prayect ishlatgan yaxshi bir biridan afzalliklari nimada qisqacha tushuncha bera olasilarmi
Savol muallifi: Shaxzodxoja
..........................................................
Javob: https://link.medium.com/GjourDDe9nb
Javob muallifi: Channel
izohdagi javob linki

.................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_35 #javob_berildi
Assalamu alaykum
Exception in thread "pool-240805-thread-5" java.lang.NullPointerException
Shunaqa exception chiqyabti
qaysi qatorda hato borligni ko`rsatmayabti,
nimadan bo`lishi mumkin
Savol muallifi: Анвар
..........................................................
Javob: https://stackoverflow.com/questions/20834161/exception-in-thread-thread-5-java-lang-nullpointerexception
Javob muallifi: Umrzoqov To'lqin
izohdagi javob linki

..........................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_36 #javob_berildi
Assalom Alaykum openssl da json faylni crt sertificat bilan imzolaydigan script bor shuni java code da yozish kerak. Yordam!!!
Savol muallifi: Egoist
..........................................................
Javob: $ openssl req -new -newkey rsa:2048 -nodes -keyout user1.key -out user1.csr \
-subj "/CN=OOO User1 Market/UID=user_1_id"

command orqali menda .csr va .key shakllanadi
.csr linsenziya olish uchun requst men uni ularga berganman ular menga .crt litsenziya berishgan keyin.

menga qo'yilgan vazifa litsenziya ya'ni .crt va
private key ya'ni .key fayl bilan .json fileni sign qilib ularga jo'natishim kerak. menda .crt .key va .json fayllar bor

openssl ni comandasini ya'ni

$ openssl cms -sign -nodetach -binary -in receipt.json -text -outform der \
-out receipt.p7b -nocerts -signer user1.crt -inkey user1.key

shuni javani o'zida hal qilishim kerak edi hal qildim ham qaysidir ma'noda


public byte[] sign(byte[] data) throws IOException, CertificateException, Operat
#savol_37 #javob_berildi
Assalomu aleykum.

Savol: Tomcat GMT 0 da database gaham GMT 0 da yoziladi databasedagi malumotlar userga o'zini time zonasi bo'yicha ko'rinadi { UI qismidan user time zonasi bo'yicha date olib kelingan
Ex:
2022-03-09 22:10:54.357
shu date ni time zonasini aniqlab
bir joyda shu time zonani ayrib yuborish kerak

Misol uchun gmt 5+ serverga 10:00 yoziladi userga 15:00 ko'rinadi menda 2 ta data bor bittasi server dagi bittasi userdagi ulardan

ulardan qanday qilib time zona ni ajratib olsam bo'ladi javob uchun rahmat )
o'zim Google dan yana qarab ko'raman
Savol muallifi: Bahriddin プログラマー
..........................................................
Javob: null
Javob muallifi: Bahriddin プログラマー
izohdagi javob linki

..............................
Savol berish uchun @spring_framework_savol_bot ga yozing
👍2
#savol_38 #javob_berildi
Assalomaleykom springni frontend tarafiga Nima organgan yaxshi thmeleafmi yoki JavaScriptni qaysidur framworkinimi malumotlarni oqib kordim thymleaf kattaroq prayectlar uchun ishlatish tavsiya qilingan lekin to'liq ular orasidagi farqi yozilgan documentatsiya topomadim ilojisi bo'sa o'zbekchada tushuntirib yuborsanglar yaxshiroq bolardi
Savol muallifi: Shaxzodxoja
..........................................................
Javob: front+backend ni birga ya'ni 1 ta proyekt ichida yozmoqchi bosez Thymleaf qo'l keladi, umuman yo'nalishiz backenddan uzoq bolsa thymleaf dan ham uzoq bo'ling😊
Javob muallifi: Shavkat T
izohdagi javob linki

....................................
Savol berish uchun @spring_framework_savol_bot ga yozing
#savol_39 #javob_berildi
Telegram botda qanday qilib xabarlarni scheudle qilib qoysa boladi, yani foydalanuvchi xohlagan vaqtda xabar kanalga joylanib boradi
Savol muallifi: To'lqinov Sarvar
..........................................................
Javob: ha, umumiy 28 ta obyekt hosil bo'ladi. 28 ta timer obyekti. agar qiladigan ishlari har xil bo'lsa, 28 ta timerTask ham.

bu joyda yana bir narsani hisobga olish kerak, ya'ni bot telegramga bir paytni o'zida cheklangan miqdorda zapros yubora oladi. misol uchun 1 sekundda 30 ta.

100 ta user 10.03.2022 01:04:30 ga task berib qo'ygan bo'lsa, bot fizicheskiy ulgirmaydi 1 sekundda 100 ta zapros yuborishga
Javob muallifi: Abdulvahid
izohdagi javob linki

....................................................................
Savol berish uchun @spring_framework_savol_bot ga yozing
👍2