spring-boot

JPA auto flush before any query

放肆的年华 提交于 2021-02-16 08:38:25
问题 From JPA documentation I can see that the AUTO is the default flush mode, flush should happen before any query execution. I have tried this on spring boot jpa and I can see the flush won't happen on queries from different entities , is that expected ? even though different entity may have relation to it ( Department <--> Person here ) The flush should trigger before any query according to this article : https://vladmihalcea.com/how-do-jpa-and-hibernate-define-the-auto-flush-mode/ // this

Spring Boot security shows Http-Basic-Auth popup after failed login

▼魔方 西西 提交于 2021-02-15 13:38:07
问题 I'm currently creating a simple app for a school project, Spring Boot backend and AngularJS frontend, but have a problem with security that I can't seem to solve. Logging in works perfectly, but when I enter a wrong password the default login popup shows up, which is kind of annoying. I've tried the annotation 'BasicWebSecurity' and putting httpBassic on disabled, but with no result (meaning, that the login procedure doesn't work at all anymore). My security class: package be.italent.security

Spring Boot security shows Http-Basic-Auth popup after failed login

空扰寡人 提交于 2021-02-15 13:37:47
问题 I'm currently creating a simple app for a school project, Spring Boot backend and AngularJS frontend, but have a problem with security that I can't seem to solve. Logging in works perfectly, but when I enter a wrong password the default login popup shows up, which is kind of annoying. I've tried the annotation 'BasicWebSecurity' and putting httpBassic on disabled, but with no result (meaning, that the login procedure doesn't work at all anymore). My security class: package be.italent.security

Junit 5 looking for actual environmental configuration to run the test

旧巷老猫 提交于 2021-02-15 07:37:16
问题 My project is using spring-boot , sping-data-jpa , spring-data-rest , hibernate I have updated to spring boot 2.3.1 . My previous test cases are on Junit 4 , I am migrating to Junit 5 . When I run my test case with junit 5 it is looking for actual environmental configurations like datasource , hibernate:dialect with Junit 4, it was not looking for it. Please find Junit 4 and Junit 5 test class for comparison Junit 4 Test import org.junit.Before; import org.junit.Test; import org.junit.runner

Trying to GET one topic http://localhost:8080/topics?id=1 in POSTMAN. Got the following error

為{幸葍}努か 提交于 2021-02-15 05:08:39
问题 Connection read-only mode is not enforceable after the connection has been established. To enforce a read only connection, set the read-only data source or connection property. ERRORCODE=4474, SQLSTATE=01000 Here is my Cotroller package com.course.springbootstarter.topic; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org

How to initialize MongoClient once in spring boot and export it to use its methods?

点点圈 提交于 2021-02-12 11:33:32
问题 Hello I am trying to export the MongoClient after a successful connection in Spring Boot and I am trying to use it in other files so that I do not have to call the connection every single time that I need to make changes in my MongoDB database. The connection is pretty simple but the goal would be to connect the application to my database once and then use it wherever I want by importing it in any Java file. Thank you 回答1: Here are couple of ways of creating an instance of MongoClient ,

How to initialize MongoClient once in spring boot and export it to use its methods?

久未见 提交于 2021-02-12 11:33:21
问题 Hello I am trying to export the MongoClient after a successful connection in Spring Boot and I am trying to use it in other files so that I do not have to call the connection every single time that I need to make changes in my MongoDB database. The connection is pretty simple but the goal would be to connect the application to my database once and then use it wherever I want by importing it in any Java file. Thank you 回答1: Here are couple of ways of creating an instance of MongoClient ,

Spring batch launches SimpleJobLauncher run method before boot run method

前提是你 提交于 2021-02-11 18:19:32
问题 I have job configuration as below @SpringBootApplication public class Test implements CommandLineRunner { @Autowired JobLauncher jobLauncher; @Autowired Job job; @Autowired private JobBuilderFactory jobs; @Autowired private StepBuilderFactory steps; public static void main(String[] args) { SpringApplication.run(Test.class, args); } @Override public void run(String... args) throws Exception { JobParameters params = new JobParametersBuilder() .addString("JobID", String.valueOf(System

IntelliJ does't have @NotBlank

别等时光非礼了梦想. 提交于 2021-02-11 18:19:24
问题 So im running my program and I need to setup @NotNull from import javaz.validation.constraints.NotBlank; All there is @NonNull private final String firstName; and import org.springframework.lang.NonNull; How do I install @NotNull or is @NonNull the same thing? 回答1: This should answer your question. Short answer: there is a subtle difference, but it all depends on what you want, so you either need to read the post I've linked above or tell us more information. 来源: https://stackoverflow.com

IntelliJ does't have @NotBlank

ⅰ亾dé卋堺 提交于 2021-02-11 18:19:09
问题 So im running my program and I need to setup @NotNull from import javaz.validation.constraints.NotBlank; All there is @NonNull private final String firstName; and import org.springframework.lang.NonNull; How do I install @NotNull or is @NonNull the same thing? 回答1: This should answer your question. Short answer: there is a subtle difference, but it all depends on what you want, so you either need to read the post I've linked above or tell us more information. 来源: https://stackoverflow.com