Skip to content

Commit 4853477

Browse files
committed
Reformat code
1 parent 625f428 commit 4853477

File tree

95 files changed

+321
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+321
-130
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ private void resolveApplicationPath() {
117117
this.path = parseApplicationPath(this.jersey.getApplicationPath());
118118
}
119119
else {
120-
this.path = findApplicationPath(
121-
AnnotationUtils.findAnnotation(this.config.getApplication().getClass(), ApplicationPath.class));
120+
this.path = findApplicationPath(AnnotationUtils.findAnnotation(
121+
this.config.getApplication().getClass(), ApplicationPath.class));
122122
}
123123
}
124124

@@ -149,7 +149,8 @@ public FilterRegistrationBean jerseyFilterRegistration() {
149149
registration.setFilter(new ServletContainer(this.config));
150150
registration.setUrlPatterns(Arrays.asList(this.path));
151151
registration.setOrder(this.jersey.getFilter().getOrder());
152-
registration.addInitParameter(ServletProperties.FILTER_CONTEXT_PATH, stripPattern(this.path));
152+
registration.addInitParameter(ServletProperties.FILTER_CONTEXT_PATH,
153+
stripPattern(this.path));
153154
addInitParameters(registration);
154155
registration.setName("jerseyFilter");
155156
registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.class));
@@ -167,8 +168,8 @@ private String stripPattern(String path) {
167168
@ConditionalOnMissingBean(name = "jerseyServletRegistration")
168169
@ConditionalOnProperty(prefix = "spring.jersey", name = "type", havingValue = "servlet", matchIfMissing = true)
169170
public ServletRegistrationBean jerseyServletRegistration() {
170-
ServletRegistrationBean registration = new ServletRegistrationBean(new ServletContainer(this.config),
171-
this.path);
171+
ServletRegistrationBean registration = new ServletRegistrationBean(
172+
new ServletContainer(this.config), this.path);
172173
addInitParameters(registration);
173174
registration.setName(getServletRegistrationName());
174175
registration.setLoadOnStartup(this.jersey.getServlet().getLoadOnStartup());
@@ -203,18 +204,23 @@ private static String parseApplicationPath(String applicationPath) {
203204
@Override
204205
public void setServletContext(ServletContext servletContext) {
205206
String servletRegistrationName = getServletRegistrationName();
206-
ServletRegistration registration = servletContext.getServletRegistration(servletRegistrationName);
207+
ServletRegistration registration = servletContext
208+
.getServletRegistration(servletRegistrationName);
207209
if (registration != null) {
208210
if (logger.isInfoEnabled()) {
209-
logger.info("Configuring existing registration for Jersey servlet '" + servletRegistrationName + "'");
211+
logger.info("Configuring existing registration for Jersey servlet '"
212+
+ servletRegistrationName + "'");
210213
}
211214
registration.setInitParameters(this.jersey.getInit());
212-
registration.setInitParameter(CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE, Boolean.TRUE.toString());
215+
registration.setInitParameter(
216+
CommonProperties.METAINF_SERVICES_LOOKUP_DISABLE,
217+
Boolean.TRUE.toString());
213218
}
214219
}
215220

216221
@Order(Ordered.HIGHEST_PRECEDENCE)
217-
public static final class JerseyWebApplicationInitializer implements WebApplicationInitializer {
222+
public static final class JerseyWebApplicationInitializer
223+
implements WebApplicationInitializer {
218224

219225
@Override
220226
public void onStartup(ServletContext servletContext) throws ServletException {
@@ -233,19 +239,22 @@ static class JacksonResourceConfigCustomizer {
233239
private static final String JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME = "com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector";
234240

235241
@Bean
236-
public ResourceConfigCustomizer resourceConfigCustomizer(final ObjectMapper objectMapper) {
242+
public ResourceConfigCustomizer resourceConfigCustomizer(
243+
final ObjectMapper objectMapper) {
237244
addJaxbAnnotationIntrospectorIfPresent(objectMapper);
238245
return new ResourceConfigCustomizer() {
239246
@Override
240247
public void customize(ResourceConfig config) {
241248
config.register(JacksonFeature.class);
242-
config.register(new ObjectMapperContextResolver(objectMapper), ContextResolver.class);
249+
config.register(new ObjectMapperContextResolver(objectMapper),
250+
ContextResolver.class);
243251
}
244252
};
245253
}
246254

247255
private void addJaxbAnnotationIntrospectorIfPresent(ObjectMapper objectMapper) {
248-
if (ClassUtils.isPresent(JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME, getClass().getClassLoader())) {
256+
if (ClassUtils.isPresent(JAXB_ANNOTATION_INTROSPECTOR_CLASS_NAME,
257+
getClass().getClassLoader())) {
249258
new ObjectMapperCustomizer().addJaxbAnnotationIntrospector(objectMapper);
250259
}
251260
}
@@ -256,18 +265,22 @@ private void addJaxbAnnotationIntrospector(ObjectMapper objectMapper) {
256265
JaxbAnnotationIntrospector jaxbAnnotationIntrospector = new JaxbAnnotationIntrospector(
257266
objectMapper.getTypeFactory());
258267
objectMapper.setAnnotationIntrospectors(
259-
createPair(objectMapper.getSerializationConfig(), jaxbAnnotationIntrospector),
260-
createPair(objectMapper.getDeserializationConfig(), jaxbAnnotationIntrospector));
268+
createPair(objectMapper.getSerializationConfig(),
269+
jaxbAnnotationIntrospector),
270+
createPair(objectMapper.getDeserializationConfig(),
271+
jaxbAnnotationIntrospector));
261272
}
262273

263274
private AnnotationIntrospector createPair(MapperConfig<?> config,
264275
JaxbAnnotationIntrospector jaxbAnnotationIntrospector) {
265-
return AnnotationIntrospector.pair(config.getAnnotationIntrospector(), jaxbAnnotationIntrospector);
276+
return AnnotationIntrospector.pair(config.getAnnotationIntrospector(),
277+
jaxbAnnotationIntrospector);
266278
}
267279

268280
}
269281

270-
private static final class ObjectMapperContextResolver implements ContextResolver<ObjectMapper> {
282+
private static final class ObjectMapperContextResolver
283+
implements ContextResolver<ObjectMapper> {
271284

272285
private final ObjectMapper objectMapper;
273286

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java

Lines changed: 67 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ public class KafkaProperties {
5353
* Comma-delimited list of host:port pairs to use for establishing the initial
5454
* connection to the Kafka cluster.
5555
*/
56-
private List<String> bootstrapServers = new ArrayList<String>(Collections.singletonList("localhost:9092"));
56+
private List<String> bootstrapServers = new ArrayList<String>(
57+
Collections.singletonList("localhost:9092"));
5758

5859
/**
5960
* Id to pass to the server when making requests; used for server-side logging.
@@ -122,7 +123,8 @@ public Template getTemplate() {
122123
private Map<String, Object> buildCommonProperties() {
123124
Map<String, Object> properties = new HashMap<String, Object>();
124125
if (this.bootstrapServers != null) {
125-
properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers);
126+
properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG,
127+
this.bootstrapServers);
126128
}
127129
if (this.clientId != null) {
128130
properties.put(CommonClientConfigs.CLIENT_ID_CONFIG, this.clientId);
@@ -131,16 +133,20 @@ private Map<String, Object> buildCommonProperties() {
131133
properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, this.ssl.getKeyPassword());
132134
}
133135
if (this.ssl.getKeystoreLocation() != null) {
134-
properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getKeystoreLocation()));
136+
properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG,
137+
resourceToPath(this.ssl.getKeystoreLocation()));
135138
}
136139
if (this.ssl.getKeystorePassword() != null) {
137-
properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, this.ssl.getKeystorePassword());
140+
properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG,
141+
this.ssl.getKeystorePassword());
138142
}
139143
if (this.ssl.getTruststoreLocation() != null) {
140-
properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getTruststoreLocation()));
144+
properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,
145+
resourceToPath(this.ssl.getTruststoreLocation()));
141146
}
142147
if (this.ssl.getTruststorePassword() != null) {
143-
properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, this.ssl.getTruststorePassword());
148+
properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG,
149+
this.ssl.getTruststorePassword());
144150
}
145151
if (!CollectionUtils.isEmpty(this.properties)) {
146152
properties.putAll(this.properties);
@@ -153,8 +159,8 @@ private Map<String, Object> buildCommonProperties() {
153159
* <p>
154160
* This allows you to add additional properties, if necessary, and override the
155161
* default kafkaConsumerFactory bean.
156-
* @return the consumer properties initialized with the customizations defined
157-
* on this instance
162+
* @return the consumer properties initialized with the customizations defined on this
163+
* instance
158164
*/
159165
public Map<String, Object> buildConsumerProperties() {
160166
Map<String, Object> properties = buildCommonProperties();
@@ -167,8 +173,8 @@ public Map<String, Object> buildConsumerProperties() {
167173
* <p>
168174
* This allows you to add additional properties, if necessary, and override the
169175
* default kafkaProducerFactory bean.
170-
* @return the producer properties initialized with the customizations defined
171-
* on this instance
176+
* @return the producer properties initialized with the customizations defined on this
177+
* instance
172178
*/
173179
public Map<String, Object> buildProducerProperties() {
174180
Map<String, Object> properties = buildCommonProperties();
@@ -181,7 +187,8 @@ private static String resourceToPath(Resource resource) {
181187
return resource.getFile().getAbsolutePath();
182188
}
183189
catch (IOException ex) {
184-
throw new IllegalStateException("Resource '" + resource + "' must be on a file system", ex);
190+
throw new IllegalStateException(
191+
"Resource '" + resource + "' must be on a file system", ex);
185192
}
186193
}
187194

@@ -190,8 +197,8 @@ public static class Consumer {
190197
private final Ssl ssl = new Ssl();
191198

192199
/**
193-
* Frequency in milliseconds that the consumer offsets are auto-committed to
194-
* Kafka if 'enable.auto.commit' true.
200+
* Frequency in milliseconds that the consumer offsets are auto-committed to Kafka
201+
* if 'enable.auto.commit' true.
195202
*/
196203
private Integer autoCommitInterval;
197204

@@ -213,8 +220,7 @@ public static class Consumer {
213220
private String clientId;
214221

215222
/**
216-
* If true the consumer's offset will be periodically committed in the
217-
* background.
223+
* If true the consumer's offset will be periodically committed in the background.
218224
*/
219225
private Boolean enableAutoCommit;
220226

@@ -358,22 +364,27 @@ public void setMaxPollRecords(Integer maxPollRecords) {
358364
public Map<String, Object> buildProperties() {
359365
Map<String, Object> properties = new HashMap<String, Object>();
360366
if (this.autoCommitInterval != null) {
361-
properties.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG, this.autoCommitInterval);
367+
properties.put(ConsumerConfig.AUTO_COMMIT_INTERVAL_MS_CONFIG,
368+
this.autoCommitInterval);
362369
}
363370
if (this.autoOffsetReset != null) {
364-
properties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, this.autoOffsetReset);
371+
properties.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,
372+
this.autoOffsetReset);
365373
}
366374
if (this.bootstrapServers != null) {
367-
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers);
375+
properties.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,
376+
this.bootstrapServers);
368377
}
369378
if (this.clientId != null) {
370379
properties.put(ConsumerConfig.CLIENT_ID_CONFIG, this.clientId);
371380
}
372381
if (this.enableAutoCommit != null) {
373-
properties.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, this.enableAutoCommit);
382+
properties.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG,
383+
this.enableAutoCommit);
374384
}
375385
if (this.fetchMaxWait != null) {
376-
properties.put(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG, this.fetchMaxWait);
386+
properties.put(ConsumerConfig.FETCH_MAX_WAIT_MS_CONFIG,
387+
this.fetchMaxWait);
377388
}
378389
if (this.fetchMinSize != null) {
379390
properties.put(ConsumerConfig.FETCH_MIN_BYTES_CONFIG, this.fetchMinSize);
@@ -382,32 +393,40 @@ public Map<String, Object> buildProperties() {
382393
properties.put(ConsumerConfig.GROUP_ID_CONFIG, this.groupId);
383394
}
384395
if (this.heartbeatInterval != null) {
385-
properties.put(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG, this.heartbeatInterval);
396+
properties.put(ConsumerConfig.HEARTBEAT_INTERVAL_MS_CONFIG,
397+
this.heartbeatInterval);
386398
}
387399
if (this.keyDeserializer != null) {
388-
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, this.keyDeserializer);
400+
properties.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,
401+
this.keyDeserializer);
389402
}
390403
if (this.ssl.getKeyPassword() != null) {
391-
properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, this.ssl.getKeyPassword());
404+
properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG,
405+
this.ssl.getKeyPassword());
392406
}
393407
if (this.ssl.getKeystoreLocation() != null) {
394-
properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getKeystoreLocation()));
408+
properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG,
409+
resourceToPath(this.ssl.getKeystoreLocation()));
395410
}
396411
if (this.ssl.getKeystorePassword() != null) {
397-
properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, this.ssl.getKeystorePassword());
412+
properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG,
413+
this.ssl.getKeystorePassword());
398414
}
399415
if (this.ssl.getTruststoreLocation() != null) {
400416
properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,
401417
resourceToPath(this.ssl.getTruststoreLocation()));
402418
}
403419
if (this.ssl.getTruststorePassword() != null) {
404-
properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, this.ssl.getTruststorePassword());
420+
properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG,
421+
this.ssl.getTruststorePassword());
405422
}
406423
if (this.valueDeserializer != null) {
407-
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, this.valueDeserializer);
424+
properties.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,
425+
this.valueDeserializer);
408426
}
409427
if (this.maxPollRecords != null) {
410-
properties.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG, this.maxPollRecords);
428+
properties.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG,
429+
this.maxPollRecords);
411430
}
412431
return properties;
413432
}
@@ -425,9 +444,8 @@ public static class Producer {
425444
private String acks;
426445

427446
/**
428-
* Default batch size in bytes. A small batch size will make batching less
429-
* common and may reduce throughput (a batch size of zero disables batching
430-
* entirely).
447+
* Default batch size in bytes. A small batch size will make batching less common
448+
* and may reduce throughput (a batch size of zero disables batching entirely).
431449
*/
432450
private Integer batchSize;
433451

@@ -438,8 +456,8 @@ public static class Producer {
438456
private List<String> bootstrapServers;
439457

440458
/**
441-
* Total bytes of memory the producer can use to buffer records waiting to be
442-
* sent to the server.
459+
* Total bytes of memory the producer can use to buffer records waiting to be sent
460+
* to the server.
443461
*/
444462
private Long bufferMemory;
445463

@@ -553,7 +571,8 @@ public Map<String, Object> buildProperties() {
553571
properties.put(ProducerConfig.BATCH_SIZE_CONFIG, this.batchSize);
554572
}
555573
if (this.bootstrapServers != null) {
556-
properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, this.bootstrapServers);
574+
properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,
575+
this.bootstrapServers);
557576
}
558577
if (this.bufferMemory != null) {
559578
properties.put(ProducerConfig.BUFFER_MEMORY_CONFIG, this.bufferMemory);
@@ -562,32 +581,39 @@ public Map<String, Object> buildProperties() {
562581
properties.put(ProducerConfig.CLIENT_ID_CONFIG, this.clientId);
563582
}
564583
if (this.compressionType != null) {
565-
properties.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, this.compressionType);
584+
properties.put(ProducerConfig.COMPRESSION_TYPE_CONFIG,
585+
this.compressionType);
566586
}
567587
if (this.keySerializer != null) {
568-
properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, this.keySerializer);
588+
properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG,
589+
this.keySerializer);
569590
}
570591
if (this.retries != null) {
571592
properties.put(ProducerConfig.RETRIES_CONFIG, this.retries);
572593
}
573594
if (this.ssl.getKeyPassword() != null) {
574-
properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG, this.ssl.getKeyPassword());
595+
properties.put(SslConfigs.SSL_KEY_PASSWORD_CONFIG,
596+
this.ssl.getKeyPassword());
575597
}
576598
if (this.ssl.getKeystoreLocation() != null) {
577-
properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG, resourceToPath(this.ssl.getKeystoreLocation()));
599+
properties.put(SslConfigs.SSL_KEYSTORE_LOCATION_CONFIG,
600+
resourceToPath(this.ssl.getKeystoreLocation()));
578601
}
579602
if (this.ssl.getKeystorePassword() != null) {
580-
properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG, this.ssl.getKeystorePassword());
603+
properties.put(SslConfigs.SSL_KEYSTORE_PASSWORD_CONFIG,
604+
this.ssl.getKeystorePassword());
581605
}
582606
if (this.ssl.getTruststoreLocation() != null) {
583607
properties.put(SslConfigs.SSL_TRUSTSTORE_LOCATION_CONFIG,
584608
resourceToPath(this.ssl.getTruststoreLocation()));
585609
}
586610
if (this.ssl.getTruststorePassword() != null) {
587-
properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG, this.ssl.getTruststorePassword());
611+
properties.put(SslConfigs.SSL_TRUSTSTORE_PASSWORD_CONFIG,
612+
this.ssl.getTruststorePassword());
588613
}
589614
if (this.valueSerializer != null) {
590-
properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, this.valueSerializer);
615+
properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,
616+
this.valueSerializer);
591617
}
592618
return properties;
593619
}

0 commit comments

Comments
 (0)