Size: a a a

Spring Framework and more

2020 April 01

I

Ivan in Spring Framework and more
бизнесмены
источник

Z

Z in Spring Framework and more
Alexandr Emelyanov
в профчатах не принято выкладывать спираченные книги. уважайте коллег - авторов книг
Понял, удаляю))
источник

EI

Edem Injection in Spring Framework and more
Никто не сталкивался? В хибернейте выкидывает искл. мол закрыта сессия... падает на методе выделенном класным, при чем, что странно метод в зеленом работает, хотя по факту суть открытия\закрытия секции и транзакции та же
источник

Ar

Arseny -> r2d2 in Spring Framework and more
так ты закрываешь сессию на 33 и пытаешься достать из неё же лист на 34й
источник

S

Stanislav in Spring Framework and more
Arseny -> r2d2
так ты закрываешь сессию на 33 и пытаешься достать из неё же лист на 34й
++
источник

Ar

Arseny -> r2d2 in Spring Framework and more
и смотри на стак трейс, тебе ведь даже указали номер строки)
источник

S

Stanislav in Spring Framework and more
Получение данных из бд происходит после закрытия сессии
источник

EI

Edem Injection in Spring Framework and more
Arseny -> r2d2
так ты закрываешь сессию на 33 и пытаешься достать из неё же лист на 34й
это для скрина код сжимал, не заметил, щас норм сделаю
источник

EI

Edem Injection in Spring Framework and more
источник

EI

Edem Injection in Spring Framework and more
на .list() это счастье падает
источник

Ar

Arseny -> r2d2 in Spring Framework and more
Edem Injection
на .list() это счастье падает
давай еще раз. сравни 21 строку и 33. в случае верхнего метода, когда ты комитишь тразнакцию? В случае нижнего, почему ты достаешь результат после комита транзакции? Где, по-твоему, происходит сам запрос в БД?
источник

EI

Edem Injection in Spring Framework and more
Arseny -> r2d2
давай еще раз. сравни 21 строку и 33. в случае верхнего метода, когда ты комитишь тразнакцию? В случае нижнего, почему ты достаешь результат после комита транзакции? Где, по-твоему, происходит сам запрос в БД?
в глаза долблюсь, спасибо больше, как бог помог. держи розочку🌹
источник
2020 April 02

U

UK in Spring Framework and more
источник

VG

Vladislav Gerasimov in Spring Framework and more
Всем привет
Использую Feign и CompleatableFuture, которым оборачиваю обычные Feign запросы.
CompleatableFuture.completedFuture(client.getSomeRequest());

Вызываю так:
CompleatableFuture<Data> future = ...
try {
CompletableFuture.allOf(future).join();
return future.get();
} catch ( InterruptedException | ExecutionException e) {
....
}

Если ошибки нету в запросе, то все работает.
Если ошибка есть (искусственно создаю, чтобы проверить кейс), то сначала заходим в свой Feign ErrorDecoder, где парсится ошибка и выкидываются нужные типы кастомных Exception, которые успешно должны отлавливаться в ControllerAdvice ExceptionHandler. Так и работает с запросами без Async и CompleatableFuture. А здесь свой Exception оборачивается в CompletionException, который не отлавливается в ControllerAdvice ExceptionHandler.

В коде выше в catch блок не попадаем.
Если туда добваить еще CompletionException | , то ловим. Видим, что внутри обернуто свое нужное исключение. Можно ли его как-то передать в ControllerAdvice, посколкьу там происходит обработка этих исключений api?
Да и в логи пишет ExceptionLoggingFilter - Uncaught exception thrown свое исключение, то есть его не поймали, что логично
источник

VG

Vladislav Gerasimov in Spring Framework and more
Разобрался. Проблема была в том, что на уровне фильтров это вызывалось. Необходимо  отловить Exception в фильтре и передать в HandlerExceptionResolver. В результате получим то поведение, как если бы ошибка попала в ControllerAdvice.
try {
      .....
filterChain.doFilter(request, response);
} catch (Exception e) {
exceptionResolver.resolveException(request, response, null, e);
}

и в фильтр нжно заинжектить Qualifier("handlerExceptionResolver") HandlerExceptionResolver exceptionResolver;

А без этого ошибка попадала в ErrorAttributes и там сериализовалась.
источник

s

spyroid in Spring Framework and more
А кто-то пользуется thin jar от spring boot?
источник

CC

Charlie Chan in Spring Framework and more
Hello everyone, could you make yours post in english?
источник

l

legitzky in Spring Framework and more
only GET
источник
2020 April 03

AK

Aбдраим Kененбаев in Spring Framework and more
Midterm exam instructions:

Create a Database "Customers" with "customers" table with firstName, lastName, emailAddress, jobTitle, mobilePhone, city, webPage fields. Don't use in-memory DB. But if you would use any way it's not restricted, even though you won't be able to get full credits for these criteria.
Create a home page ("/", "index") that lists the "Welcome message" and link to the /customers web page which displays all customers. If the customers' web page is null display 'No customers" text. Use the same logic and format for the "Reading List" project as given in the book Spring Boot in Action.
Create "Customers" web page to list all existing customers in the DB or implement the REST call to retrieve all customers as JSON file.
Create "Add customer" form to add new customers to the "Customers" DB or implement the REST call to add new a customer to the DB.
Implement Spring Security for adding new customers.
Create your classes under corresponding packages (model, dao, controller, service, repository).
Any extra features could be also graded add added to the total grade. Bonus points will be decided after evaluations of your extra features.
Any custom implementation must be commented inside the separate file ("README.md").
Create your views (in case you have them) under "resources/templates/" package.
Some additional files have been provided. You can use the existing DB file or implement your own.
источник

AK

Aбдраим Kененбаев in Spring Framework and more
Hello help please I have 6 hours
источник