Add and enforce spring checkstyle configurations

This commit is contained in:
Simon DeMartini
2022-03-19 00:25:55 -07:00
committed by Dave Syer
parent 7254dc8be7
commit 57c54fad2f
46 changed files with 1397 additions and 956 deletions

View File

@@ -1,17 +1,31 @@
/*
* Copyright 2018-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.guice;
import com.google.inject.AbstractModule;
import com.google.inject.CreationException;
import com.google.inject.Module;
import com.google.inject.multibindings.OptionalBinder;
import org.junit.AfterClass;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.guice.BindingDeduplicationTests.SomeDependency;
import org.springframework.guice.BindingDeduplicationTests.SomeOptionalDependency;
import org.springframework.guice.annotation.EnableGuiceModules;
import static org.junit.Assert.assertNotNull;
@@ -51,32 +65,32 @@ public class BindingDeduplicationTests {
}
@EnableGuiceModules
@Configuration
static class BindingDeduplicationTestsConfig {
@Bean
SomeDependency someBean() {
return new SomeDependency();
}
@Bean
SomeOptionalDependency someOptionalBean() {
return new SomeOptionalDependency();
}
@Bean
Module module() {
return new AbstractModule() {
@Override
protected void configure() {
bind(SomeDependency.class).asEagerSingleton();
OptionalBinder.newOptionalBinder(binder(), SomeOptionalDependency.class).setDefault()
.to(SomeOptionalDependency.class);
}
};
}
}
}
@EnableGuiceModules
@Configuration
class BindingDeduplicationTestsConfig {
@Bean
public SomeDependency someBean() {
return new SomeDependency();
}
@Bean
public SomeOptionalDependency someOptionalBean() {
return new SomeOptionalDependency();
}
@Bean
public Module module() {
return new AbstractModule() {
@Override
protected void configure() {
bind(SomeDependency.class).asEagerSingleton();
OptionalBinder.newOptionalBinder(binder(), SomeOptionalDependency.class).setDefault()
.to(SomeOptionalDependency.class);
}
};
}
}