• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ljacqu / wordeval / 14561507106

20 Apr 2025 04:52PM UTC coverage: 55.233% (-0.08%) from 55.313%
14561507106

push

github

ljacqu
Convert all main methods to self-contained Spring beans

291 of 596 branches covered (48.83%)

0 of 9 new or added lines in 4 files covered. (0.0%)

760 of 1376 relevant lines covered (55.23%)

3.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/ch/jalu/wordeval/config/SpringContainedRunner.java
1
package ch.jalu.wordeval.config;
2

3
import org.springframework.boot.CommandLineRunner;
4
import org.springframework.boot.SpringApplication;
5

6
/**
7
 * Runnable Spring boot application that is self-contained. Command-line tools that need the <i>wordeval</i>
8
 * Spring context can extend this class in order to benefit from dependency injection etc. without any
9
 * boilerplate code besides defining a main method calling {@link #runApplication}.
10
 * <p>
11
 * Extending classes should not be annotated with any Spring annotation so that they are not picked up
12
 * by the general Spring configuration, which would cause this runner to be run elsewhere.
13
 * This approach avoids the need of defining additional configuration classes or further nesting.
14
 * The extending class's logic is simply implemented in {@link CommandLineRunner#run}.
15
 */
NEW
16
public abstract class SpringContainedRunner implements CommandLineRunner {
×
17

18
  /**
19
   * Starts a Spring application with the base configuration and the supplied class as additional bean.
20
   * The provided class should not be annotated with any Spring annotations so that the class is not
21
   * picked up by the base config (see class javadoc).
22
   * <p>
23
   * The main method of all extending classes should be a call to this method.
24
   *
25
   * @param runnerClass {@code this} class extending {@link SpringContainedRunner}
26
   * @param args command-line arguments
27
   */
28
  protected static void runApplication(Class<?> runnerClass, String... args) {
NEW
29
    Class<?>[] sources = {BaseConfiguration.class, runnerClass};
×
NEW
30
    SpringApplication.run(sources, args);
×
NEW
31
  }
×
32
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc