@SpringBootTest methods are not transactional by default. This is the case for @DataJpaTest.
The ApplicationContext is not recreated for each @SpringBootTest, only if a differently configured context is needed or the context has been removed because of @DirtiesContext annotation.
If no configuration is specified, then @SpringBootTest searches for @SpringBootConfiguration (see https://docs.spring.io/spring-boot/api/java/org/springframework/boot/test/context/SpringBootTest.html#classes() ) and there must only be one class annotated with @SpringBootConfiguration (see https://docs.spring.io/spring-boot/api/java/org/springframework/boot/SpringBootConfiguration.html )
B - is not entirely true, Test methods annotated with @SpringBootTest do not recreate the ApplicationContext for each test method. Instead, the ApplicationContext is created once per test class, and it is cached and shared across multiple test methods in the same class (or even across different test classes), unless specifically instructed otherwise.
The correct answers are:
B. Test methods in a @SpringBootTest class are transactional by default. C. @SpringBootTest is typically used for integration testing.
Explanation:
B. Test methods in a @SpringBootTest class are transactional by default. This means that any changes to the database made by a test method will be rolled back by default.
C. @SpringBootTest is typically used for integration testing. It provides a full Spring ApplicationContext, including all of the infrastructure beans, as well as your application's beans. It is also capable of starting a web server, making it ideal for testing web applications, and testing a broad range of application components.
I think the E answere is correct.
see https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/test/context/SpringBootTest.html
the @SpringBootTest is not applicable at method level.
There is no @TestApplicationContext annotation in Spring Testing.
upvoted 1 times
...
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
quakquak3
1 month, 1 week agoPeit
1 month, 1 week agoUteman
3 months, 2 weeks agoUteman
3 months, 2 weeks agoEvoila_TrainingMaterial
5 months, 2 weeks ago2211094
7 months, 1 week agoasaladino75
10 months, 3 weeks agoGlothan
1 year, 1 month agoTolo01
1 year, 5 months agonesreenmhd123
1 year, 3 months ago