मैं स्प्रिंग बूट 1.4.RELEASE का उपयोग कर मेमोरी डीबी में परीक्षण बनाना चाहता हूं।एनोटेशन @ डेटाजेपाटेस्ट के साथ परीक्षण - एंबेडेडडेटाबेस टाइप की आवश्यकता है
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dataSource': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: EmbeddedDatabaseType is required; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: EmbeddedDatabaseType is required
मेरे स्प्रिंग बूट गुण:
spring.jpa.database=ORACLE
spring.jpa.show-sql=false
spring.jpa.hibernate.ddl-auto=validate
spring.datasource.driverClassName=oracle.jdbc.OracleDriver
spring.datasource.url=..
spring.datasource.username=..
spring.datasource.password=..
spring.datasource.max-active=20
spring.datasource.max-idle=5
spring.datasource.min-idle=1
spring.datasource.initial-size=5
spring.datasource.testWhileIdle = true
spring.datasource.timeBetweenEvictionRunsMillis = 20000
#spring.datasource.test-on-borrow=true
spring.datasource.validation-query=select 1 from dual;
spring.jpa.properties.hibernate.order_inserts=true
spring.jpa.properties.hibernate.order_updates=true
spring.jpa.properties.hibernate.jdbc.batch_size=100
spring.jpa.properties.hibernate.cache.use_second_level_cache=false
निर्भरता:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
<version>2.33</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-remote-shell</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3.0</version>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-core</artifactId>
<version>1.4.18</version>
</dependency>
<dependency>
<groupId>org.perf4j</groupId>
<artifactId>perf4j</artifactId>
<version>0.9.16</version>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava</artifactId>
<version>1.0.13</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>4.2.3.RELEASE</version>
</dependency>
मैं था मैं निम्न त्रुटि हो रही है जब मैं परीक्षण करने के लिए यह एनोटेशन @DataJpaTest जोड़ा गया है और परीक्षण निष्पादित यह उम्मीद करते हुए कि यह एनोटेशन मेरी वास्तविक डीबी को मेमोरी डीबी में बदल देगा। इस मैं टेस्ट मैचों में हाइबरनेट सत्यापन के बढ़ने की बात थी को
additiona में:
आप के लिए इसे पाने के लिए कुछ भी करने की जरूरत नहीं था काम? मुझे आपके जैसा ही समस्या है, लेकिन जब मैं hsqldb निर्भरता जोड़ता हूं तो मुझे 'org.hsqldb.HsqlException के बारे में त्रुटियां मिलती हैं: उपयोगकर्ता को विशेषाधिकार या ऑब्जेक्ट की कमी नहीं होती है: PG_CLASS' – snowe
मेरे पास समान था। मुझे परीक्षणों में हाइबरनेट सत्यापन को बदलना पड़ा: spring.jpa.hibernate.ddl-auto = test/resource/application.properties में create-drop जोड़ा गया – mrh