Let me answer my own question.
I first created the QBankAccountDetails.java and QFixedDepositDetails.java and their classes by adding the dependencies below and changed the plugins:
In pom.xml:
...
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-mongodb</artifactId>
<version>3.6.6</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>3.7.4</version>
</dependency>
.....
<build>
<plugins>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Download Apache
Maven. Set the path variables as instructed by MKyong (
https://www.mkyong.com/maven/how-to-install-maven-in-windows/).
In a command prompt, navigate to the ch09-spring-mongo-data project folder. Type mvn compile. This can generate the Q-classes and
java code in the target/generated-sources/java.
Copy the Q-classes , in this case, QBankAccountDetail.java and QFixedDepositDetails.java to the corresponding package.
Close and delete the ch09-spring-mongo-data project from the Eclipse workspace. Open the original project with the original pom.xml file. Copy the Q classes to the corresponding package in the original project.
Now, the original project can compile with the Q classes.
Install MongoDB community instruction and follow their instruction to run it.
Run the BankApp.java from the original project. It should work.