├── .gitignore
├── README.md
├── pom.xml
└── src
└── main
├── java
├── com
│ └── jthink
│ │ └── teemo
│ │ └── properties
│ │ └── TaskProperties.java
└── org
│ └── springframework
│ └── context
│ └── annotation
│ └── PropertySource.java
├── resources
├── application.properties
├── banner.txt
├── log4j.xml
└── properties
│ └── teemo.properties
└── scala
└── com
└── jthink
└── teemo
├── configuration
└── SparkConfiguration.scala
├── dto
└── ApiStatisticDto.scala
├── launcher
└── Launcher.scala
├── model
├── key
│ ├── Key.scala
│ └── statistic
│ │ ├── TimeApiKey.scala
│ │ └── TimeApiStatusKey.scala
└── value
│ ├── Value.scala
│ └── statistic
│ ├── StatusCntValue.scala
│ └── SuccessFailedCntValue.scala
└── task
├── Task.scala
└── TestTask.scala
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/
2 | target/
3 | file/
4 | logs/
5 | gen-java/
6 | .externalToolBuilders/
7 | .settings/
8 | .gradle/
9 | .classpath
10 | .gradletasknamecache
11 | .buildpath
12 | .project
13 | .springBeans
14 | dependency-reduced-pom.xml
15 | *.iml
16 | nohup.out
17 | /tmp
18 | /.apt_generated/
19 | .idea/
20 | disconf/
21 | /target/
22 | /build/
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | scala+spring boot写spark代码骨架
2 |
3 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
Given a file {@code app.properties} containing the key/value pair 30 | * {@code testbean.name=myTestBean}, the following {@code @Configuration} class 31 | * uses {@code @PropertySource} to contribute {@code app.properties} to the 32 | * {@code Environment}'s set of {@code PropertySources}. 33 | * 34 | *
35 | * @Configuration 36 | * @PropertySource("classpath:/com/myco/app.properties") 37 | * public class AppConfig { 38 | * @Autowired 39 | * Environment env; 40 | * 41 | * @Bean 42 | * public TestBean testBean() { 43 | * TestBean testBean = new TestBean(); 44 | * testBean.setName(env.getProperty("testbean.name")); 45 | * return testBean; 46 | * } 47 | * }48 | * 49 | * Notice that the {@code Environment} object is @{@link 50 | * org.springframework.beans.factory.annotation.Autowired Autowired} into the 51 | * configuration class and then used when populating the {@code TestBean} object. Given 52 | * the configuration above, a call to {@code testBean.getName()} will return "myTestBean". 53 | * 54 | *
72 | * @Configuration 73 | * @PropertySource("classpath:/com/${my.placeholder:default/path}/app.properties") 74 | * public class AppConfig { 75 | * @Autowired 76 | * Environment env; 77 | * 78 | * @Bean 79 | * public TestBean testBean() { 80 | * TestBean testBean = new TestBean(); 81 | * testBean.setName(env.getProperty("testbean.name")); 82 | * return testBean; 83 | * } 84 | * }85 | * 86 | * Assuming that "my.placeholder" is present in one of the property sources already 87 | * registered, e.g. system properties or environment variables, the placeholder will 88 | * be resolved to the corresponding value. If not, then "default/path" will be used as a 89 | * default. Expressing a default value (delimited by colon ":") is optional. If no 90 | * default is specified and a property cannot be resolved, an {@code 91 | * IllegalArgumentException} will be thrown. 92 | * 93 | *
103 | * @Configuration 104 | * @PropertySource("classpath:/com/myco/a.properties") 105 | * public class ConfigA { } 106 | * 107 | * @Configuration 108 | * @PropertySource("classpath:/com/myco/b.properties") 109 | * public class ConfigB { } 110 | *111 | * 112 | * The override ordering depends on the order in which these classes are registered 113 | * with the application context. 114 | *
115 | * AnnotationConfigApplicationContext ctx = 116 | * new AnnotationConfigApplicationContext(); 117 | * ctx.register(ConfigA.class); 118 | * ctx.register(ConfigB.class); 119 | * ctx.refresh(); 120 | *121 | * 122 | * In the scenario above, the properties in {@code b.properties} will override any 123 | * duplicates that exist in {@code a.properties}, because {@code ConfigB} was registered 124 | * last. 125 | * 126 | *
In certain situations, it may not be possible or practical to tightly control 127 | * property source ordering when using {@code @ProperySource} annotations. For example, 128 | * if the {@code @Configuration} classes above were registered via component-scanning, 129 | * the ordering is difficult to predict. In such cases - and if overriding is important - 130 | * it is recommended that the user fall back to using the programmatic PropertySource API. 131 | * See {@link org.springframework.core.env.ConfigurableEnvironment ConfigurableEnvironment} 132 | * and {@link org.springframework.core.env.MutablePropertySources MutablePropertySources} 133 | * javadocs for details. 134 | * 135 | * @author Chris Beams 136 | * @author Phillip Webb 137 | * @since 3.1 138 | * @see PropertySources 139 | * @see Configuration 140 | * @see org.springframework.core.env.PropertySource 141 | * @see org.springframework.core.env.ConfigurableEnvironment#getPropertySources() 142 | * @see org.springframework.core.env.MutablePropertySources 143 | */ 144 | @Target(ElementType.TYPE) 145 | @Retention(RetentionPolicy.RUNTIME) 146 | @Documented 147 | public @interface PropertySource { 148 | 149 | /** 150 | * Indicate the name of this property source. If omitted, a name 151 | * will be generated based on the description of the underlying 152 | * resource. 153 | * @see org.springframework.core.env.PropertySource#getName() 154 | * @see org.springframework.core.io.Resource#getDescription() 155 | */ 156 | String name() default ""; 157 | 158 | /** 159 | * Indicate the resource location(s) of the properties file to be loaded. 160 | * For example, {@code "classpath:/com/myco/app.properties"} or 161 | * {@code "file:/path/to/file"}. 162 | *
Resource location wildcards (e.g. **/*.properties) are not permitted; 163 | * each location must evaluate to exactly one {@code .properties} resource. 164 | *
${...} placeholders will be resolved against any/all property sources already 165 | * registered with the {@code Environment}. See {@linkplain org.springframework.context.annotation.PropertySource above} 166 | * for examples. 167 | *
Each location will be added to the enclosing {@code Environment} as its own 168 | * property source, and in the order declared. 169 | */ 170 | String[] value(); 171 | 172 | /** 173 | * Indicate if failure to find the a {@link #value() property resource} should be 174 | * ignored. 175 | *
{@code true} is appropriate if the properties file is completely optional.
176 | * Default is {@code false}.
177 | * @since 4.0
178 | */
179 | boolean ignoreResourceNotFound() default false;
180 |
181 | }
182 |
--------------------------------------------------------------------------------
/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | spring.spark.task.name=${task.name}
2 | spring.spark.task.srcPath=${task.src.path}
3 |
--------------------------------------------------------------------------------
/src/main/resources/banner.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | ▄▄▄▄▀ ▄███▄ ▄███▄ █▀▄▀█ ████▄
4 | ▀▀▀ █ █▀ ▀ █▀ ▀ █ █ █ █ █
5 | █ ██▄▄ ██▄▄ █ ▄ █ █ █
6 | █ █▄ ▄▀ █▄ ▄▀ █ █ ▀████
7 | ▀ ▀███▀ ▀███▀ █
8 | ▀
9 |
--------------------------------------------------------------------------------
/src/main/resources/log4j.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |