Mocking fails for some reason
```java
@SpringBootTest
@TestPropertySource(locations = "classpath:application-test.properties")
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
class UserServiceTests {...
dependency isnt injected into my service
hey guys. can smb help me out. i have a service
```java
@Service
@Slf4j
public class MyService {...
Failing test under misterious circumstances
https://github.com/KoblizekXD/notecz-backend/blob/4a70434b5c139b2d6bf5c6953fbf49a92cebded5/src/test/java/lol/koblizek/notecz/api/user/UserServiceTests.java#L49
this test seems to be failing, altough when i try to run UserRepositoryTests and test the validation, it correctly throws an exception, but here the saveAndFlush just returns null......
Trying to load a Font from resources throws a BufferUnderflowException
I am trying to load a Selawik font from my project's resources with following code:
```java
try (InputStream is = getClass().getResourceAsStream("/fonts/selawk.ttf")) {
Font selawik = Font.createFont(Font.TRUETYPE_FONT, is);
}...
some help needed with fixing circular dependencies
hey guys. can smb help me out with fixing circular dependencies?
```
The dependencies of some of the beans in the application context form a cycle:
infoRestController...
do i need to return DTO from my controller when handling errors?
hey guys. i want to ask for some help. in my service i do some checks and throw custom exceptions which later i handle in
RestResponseEntityExceptionHandler
. it looks like this:
```java
@ControllerAdvice
@Slf4j
public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {...Spring Boot Microservices with JWT Issues
I try to implement an example of Spring Boot Microservices with JWT. I have some problems following:
1 ) I cannot run all integration tests of product service even if I defined bearer token
2 ) After login and get access token, I cannot send any request to product service. I got 500 Internal Server Error.
How can I fix it? I hope you can help me?
Here is the repo : https://github.com/Rapter1990/springbootmicroserviceswithsecurity...
Help with Lombok
I am making utility methods for sending discord webhooks.
my goal is this:
```java
DiscordWebhook webhook = DiscordWebhook.builder()
.webhookURI(new URI("https://discord.com/api/webhooks/123"))...
Spring Boot @Mapping gives no read accessor error
Hello! I'm trying to use @mapping to map a DTo from entities
My Main DTO is
```
public class MainDto {...
how to properly handle case when theres no records in the db table?
hey guys. so i have my CustomerRepo in my service and i want to handle a scenario when there are no customers with given id. so far i have this:
```java
Optional<Customer> customer=customerRepository.findById(Long.valueOf(paymentInformationRequest.getClientId()));
if (customer.isEmpty()) {
log.info("BGWService.createPaymentInformation. no customer with id: {}", paymentInformationRequest.getClientId());...
Spring JPA
I am tryna Delete the forgotPassword Enetity if the Otp expired time is passed out and that is 10 sec right now but after the Otp time expired the otp entity is not deleting itself from Db . Here is the implemet ```if (forgotPassword.getOtpExpireDate().before(Date.from(Instant.now()))) {
if (forgotPassword.getOtpExpireDate().before(Date.from(Instant.now()))) {
Long fId = forgotPassword.getForgotpasswordId();...
if (forgotPassword.getOtpExpireDate().before(Date.from(Instant.now()))) {
Long fId = forgotPassword.getForgotpasswordId();...
Why I get this error?
I was copying exactly the same code from a video I was watching about graphics.
It worked perfectly for him but not for me, why?...
Java Mail Sender
I am Getting issue while try to send a email to the user after config everything and i dont know how to resolve it ```Failed messages: org.eclipse.angus.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com , 587; timeout -1;
nested exception is:
java.net.UnknownHostException: smtp.gmail.com ; message exceptions (1) are:
Failed message 1: org.eclipse.angus.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com , 587; timeout -1;
nested exception is:...
return only http status from the controller
hey guys. i want to ask for some help. i have a controller and i want it to return only http status and no body. can i do it this way?
```java
@PostMapping(value = "/createPaymentConfirmation", produces = "application/json")
public ResponseEntity createPaymentConfirmation(@RequestBody @Valid PaymentDTO paymentConfirmationRequest) {
paymentService.createPaymentpaymentConfirmation(paymentConfirmationRequest);...
How to add blank lines to the end of a Document?
I'm working on a text editor and it needs to copy some text from one JTextArea to another at the same line, but when one adds a line I can't copy it over with the code I'm using because the document doesnt have enough Elements. My code is ```java
addCaretListener(new CaretListener() {
public void caretUpdate(CaretEvent ce) {
JTextComponent comp = (JTextComponent)ce.getSource();
int pos = comp.getCaretPosition();...
How to connect Java server to node.js?
in simple terms, I am trying to host a website that you upload a .mp4 to, which i want it to be sent to a java server, where the java server then returns a different video. how can i accomplish this?
I.E. what build tools and software, and what dependencies help me work with servers...
Custom AuthenticationFailureHandler
i am tryna make a Custom Authentication Failure Handler like this ->
```
@Component
public class CustomAuthenticationHandler implements AuthenticationFailureHandler {...
column "client_id" of relation "payments" does not exist
hey guys. can smb help me out? in my java project i have this entity:
```java
@Data
@Entity
@Table(name="payments")...