What is this spring.jpa.open-in-view=true property in Spring Boot?

I saw spring.jpa.open-in-view=true property in Spring Boot documentation for JPA configuration. Is the true default value for this property if it’s not provided at all?; What does this really do? I did not find any good explaining for it; Does it make you use SessionFactory instead of EntityManagerFactory? If yes, how can I tell it … Read more

Unable to find a @SpringBootConfiguration when doing a JpaTest

I’m new to frameworks (just passed the class) and this is my first time using Spring Boot. I’m trying to run a simple Junit test to see if my CrudRepositories are indeed working. The error I keep getting is: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=…) with your test java.lang.IllegalStateException … Read more

How do I activate a Spring Boot profile when running from IntelliJ?

I have 5 environments: – local (my development machine) – dev – qc – uat – live – staging I want different application properties to be used for each environment, so I have the following properties files each which have a different URL for the datasource: – application.properties (containing common properties) – application-local.properties – application-dev.properties … Read more

Spring Boot – Cannot determine embedded database driver class for database type NONE

This is the error that is thrown when trying to run my web app: [INFO] WARNING: Nested in org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource’ defined in class path … Read more

Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured

I am working on a Spring Boot Batch example with MongoDB and I have already started the mongod server. When I launch my application, I am getting the error below. Any pointers for this issue? *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded … Read more

Override default Spring-Boot application.properties settings in Junit Test

I have a Spring-Boot application where the default properties are set in an application.properties file in the classpath (src/main/resources/application.properties). I would like to override some default settings in my JUnit test with properties declared in a test.properties file (src/test/resources/test.properties) I usualy have a dedicated Config Class for my Junit Tests, e.g. package foo.bar.test; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; … Read more

Setting active profile and config location from command line in spring boot

I have a spring boot application. I have three profiles in my application-> development, staging and production. So I have 3 files application-development.yml application-staging.yml application-production.yml My application.yml resides inside src/main/resources. I have set the active profile in application.yml as : spring: profiles.active: development The other 3 profile specific config files are present in C:\config folder. … Read more