/src/main/java is the root folder for the java source in the maven project. So this is the correct root folder.
But it is better to use packages in a java project. - Packages are mapped to directories.
Thus, it is often recommended to have some package, for example com.my_domain.my_application.service And this will correspond to the folder /src/main/java/com/my_domain/my_application/service
@Configuration annotated classes are java classes, and therefore they must be compiled. In the mavern project, by default only files in /src/main/java and /src/test/java . If you want to separate the @Configuration classes, this is possible, but not in the src/xxx/resource folder.
The only thing you need to do is decal the additional source directory in maven using maven to build a helper plugin .
<build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> <goals> <source>add-source</source> </goals> <configuration> <sources> <source>${basedir}/src/main/javaconfig</source> </sources> </configuration> </execution> </executions> </plugin> </plugins> </build>
You now have an additional java /src/main/javaconfig source folder where you can place @Configuration files. The contents in this folder are merged with one of /src/main/java before compilation. (After adding this parameter to pom, you need to instruct eclipse to update the project configuration).
Ralph source share