mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish formatting
This commit is contained in:
parent
4b9cba351b
commit
6121208cbb
@ -126,6 +126,7 @@ public class ManagementWebSecurityAutoConfiguration {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
@ -45,8 +45,8 @@ import org.springframework.web.util.UrlPathHelper;
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "endpoints.jolokia", ignoreUnknownFields = false)
|
||||
@HypermediaDisabled
|
||||
public class JolokiaMvcEndpoint extends AbstractNamedMvcEndpoint
|
||||
implements InitializingBean, ApplicationContextAware, ServletContextAware, DisposableBean {
|
||||
public class JolokiaMvcEndpoint extends AbstractNamedMvcEndpoint implements
|
||||
InitializingBean, ApplicationContextAware, ServletContextAware, DisposableBean {
|
||||
|
||||
private final ServletWrappingController controller = new ServletWrappingController();
|
||||
|
||||
|
@ -64,8 +64,8 @@ public class AuthorizationAuditListener extends AbstractAuthorizationAuditListen
|
||||
if (event.getAuthentication().getDetails() != null) {
|
||||
data.put("details", event.getAuthentication().getDetails());
|
||||
}
|
||||
publish(new AuditEvent(event.getAuthentication().getName(),
|
||||
AUTHORIZATION_FAILURE, data));
|
||||
publish(new AuditEvent(event.getAuthentication().getName(), AUTHORIZATION_FAILURE,
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -346,8 +346,8 @@ public class CrshAutoConfigurationTests {
|
||||
&& authentication.getCredentials().equals(PASSWORD)) {
|
||||
authentication = new UsernamePasswordAuthenticationToken(
|
||||
authentication.getPrincipal(),
|
||||
authentication.getCredentials(), Collections
|
||||
.singleton(new SimpleGrantedAuthority("ACTUATOR")));
|
||||
authentication.getCredentials(), Collections.singleton(
|
||||
new SimpleGrantedAuthority("ACTUATOR")));
|
||||
}
|
||||
else {
|
||||
throw new BadCredentialsException(
|
||||
|
@ -269,8 +269,8 @@ public class EndpointMBeanExporterTests {
|
||||
MBeanExporter mbeanExporter = registerLoggersEndpoint();
|
||||
Object response = mbeanExporter.getServer().invoke(
|
||||
getObjectName("loggersEndpoint", this.context), "setLogLevel",
|
||||
new Object[]{"com.example", "trace"},
|
||||
new String[]{String.class.getName(), String.class.getName()});
|
||||
new Object[] { "com.example", "trace" },
|
||||
new String[] { String.class.getName(), String.class.getName() });
|
||||
assertThat(response).isNull();
|
||||
}
|
||||
|
||||
@ -280,10 +280,9 @@ public class EndpointMBeanExporterTests {
|
||||
this.thrown.expect(MBeanException.class);
|
||||
this.thrown.expectCause(hasMessage(containsString("No enum constant")));
|
||||
this.thrown.expectCause(hasMessage(containsString("LogLevel.INVALID")));
|
||||
mbeanExporter.getServer().invoke(
|
||||
getObjectName("loggersEndpoint", this.context), "setLogLevel",
|
||||
new Object[]{"com.example", "invalid"},
|
||||
new String[]{String.class.getName(), String.class.getName()});
|
||||
mbeanExporter.getServer().invoke(getObjectName("loggersEndpoint", this.context),
|
||||
"setLogLevel", new Object[] { "com.example", "invalid" },
|
||||
new String[] { String.class.getName(), String.class.getName() });
|
||||
}
|
||||
|
||||
private MBeanExporter registerLoggersEndpoint() {
|
||||
|
@ -109,6 +109,7 @@ public class MvcEndpointsTests {
|
||||
TestMvcEndpoint(Endpoint<?> delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class OtherTestMvcEndpoint extends EndpointMvcAdapter {
|
||||
@ -116,6 +117,7 @@ public class MvcEndpointsTests {
|
||||
OtherTestMvcEndpoint(Endpoint<?> delegate) {
|
||||
super(delegate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ public class AuthenticationAuditListenerTests {
|
||||
AuditApplicationEvent event = handleAuthenticationEvent(
|
||||
new AuthenticationSwitchUserEvent(
|
||||
new UsernamePasswordAuthenticationToken("user", "password"),
|
||||
new User("user", "password",
|
||||
AuthorityUtils.commaSeparatedStringToAuthorityList("USER"))));
|
||||
new User("user", "password", AuthorityUtils
|
||||
.commaSeparatedStringToAuthorityList("USER"))));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_SWITCH);
|
||||
}
|
||||
@ -98,12 +98,12 @@ public class AuthenticationAuditListenerTests {
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(
|
||||
"user", "password");
|
||||
authentication.setDetails(details);
|
||||
AuditApplicationEvent event = handleAuthenticationEvent(new AuthenticationFailureExpiredEvent(
|
||||
authentication, new BadCredentialsException("Bad user")));
|
||||
AuditApplicationEvent event = handleAuthenticationEvent(
|
||||
new AuthenticationFailureExpiredEvent(authentication,
|
||||
new BadCredentialsException("Bad user")));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
|
||||
assertThat(event.getAuditEvent().getData())
|
||||
.containsEntry("details", details);
|
||||
assertThat(event.getAuditEvent().getData()).containsEntry("details", details);
|
||||
}
|
||||
|
||||
private AuditApplicationEvent handleAuthenticationEvent(
|
||||
|
@ -56,7 +56,8 @@ public class AuthorizationAuditListenerTests {
|
||||
public void testAuthenticationCredentialsNotFound() {
|
||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||
new AuthenticationCredentialsNotFoundEvent(this,
|
||||
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
||||
Collections.<ConfigAttribute>singletonList(
|
||||
new SecurityConfig("USER")),
|
||||
new AuthenticationCredentialsNotFoundException("Bad user")));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
.isEqualTo(AuthenticationAuditListener.AUTHENTICATION_FAILURE);
|
||||
@ -66,7 +67,8 @@ public class AuthorizationAuditListenerTests {
|
||||
public void testAuthorizationFailure() {
|
||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||
new AuthorizationFailureEvent(this,
|
||||
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
||||
Collections.<ConfigAttribute>singletonList(
|
||||
new SecurityConfig("USER")),
|
||||
new UsernamePasswordAuthenticationToken("user", "password"),
|
||||
new AccessDeniedException("Bad user")));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
@ -81,7 +83,8 @@ public class AuthorizationAuditListenerTests {
|
||||
authentication.setDetails(details);
|
||||
AuditApplicationEvent event = handleAuthorizationEvent(
|
||||
new AuthorizationFailureEvent(this,
|
||||
Collections.<ConfigAttribute>singletonList(new SecurityConfig("USER")),
|
||||
Collections.<ConfigAttribute>singletonList(
|
||||
new SecurityConfig("USER")),
|
||||
authentication, new AccessDeniedException("Bad user")));
|
||||
assertThat(event.getAuditEvent().getType())
|
||||
.isEqualTo(AuthorizationAuditListener.AUTHORIZATION_FAILURE);
|
||||
|
@ -30,7 +30,6 @@ public enum SearchStrategy {
|
||||
|
||||
/**
|
||||
* Search all parents and ancestors, but not the current context.
|
||||
*
|
||||
* @deprecated since 1.5 in favor of {@link SearchStrategy#ANCESTORS}
|
||||
*/
|
||||
@Deprecated PARENTS,
|
||||
|
@ -84,6 +84,7 @@ abstract class DataSourceConfiguration {
|
||||
|
||||
/**
|
||||
* DBCP DataSource configuration.
|
||||
*
|
||||
* @deprecated as of Spring Boot 1.5 in favor of DBCP2
|
||||
*/
|
||||
@ConditionalOnClass(org.apache.commons.dbcp.BasicDataSource.class)
|
||||
|
@ -124,8 +124,8 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized
|
||||
runScripts(scripts, username, password);
|
||||
}
|
||||
|
||||
private List<Resource> getScripts(String propertyName,
|
||||
List<String> resources, String fallback) {
|
||||
private List<Resource> getScripts(String propertyName, List<String> resources,
|
||||
String fallback) {
|
||||
if (resources != null) {
|
||||
return getResources(propertyName, resources, true);
|
||||
}
|
||||
@ -136,8 +136,8 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized
|
||||
return getResources(propertyName, fallbackResources, false);
|
||||
}
|
||||
|
||||
private List<Resource> getResources(String propertyName,
|
||||
List<String> locations, boolean validate) {
|
||||
private List<Resource> getResources(String propertyName, List<String> locations,
|
||||
boolean validate) {
|
||||
List<Resource> resources = new ArrayList<Resource>();
|
||||
for (String location : locations) {
|
||||
for (Resource resource : doGetResources(location)) {
|
||||
|
@ -130,6 +130,7 @@ public class JmsProperties {
|
||||
? this.concurrency + "-" + this.maxConcurrency
|
||||
: String.valueOf(this.concurrency));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Template {
|
||||
|
@ -30,8 +30,8 @@ import org.springframework.jdbc.support.SQLExceptionTranslator;
|
||||
import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
|
||||
|
||||
/**
|
||||
* Transforms {@link java.sql.SQLException} into a Spring-specific {@link
|
||||
* DataAccessException}.
|
||||
* Transforms {@link java.sql.SQLException} into a Spring-specific
|
||||
* {@link DataAccessException}.
|
||||
*
|
||||
* @author Lukas Eder
|
||||
* @author Andreas Ahlenstorf
|
||||
|
@ -56,7 +56,8 @@ public class ValidationAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public MethodValidationPostProcessor methodValidationPostProcessor(Validator validator) {
|
||||
public MethodValidationPostProcessor methodValidationPostProcessor(
|
||||
Validator validator) {
|
||||
MethodValidationPostProcessor processor = new MethodValidationPostProcessor();
|
||||
processor.setValidator(validator);
|
||||
return processor;
|
||||
|
@ -1554,6 +1554,7 @@ public class ServerProperties
|
||||
public void setRotate(boolean rotate) {
|
||||
this.rotate = rotate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -297,9 +297,8 @@ public class DataSourceInitializerTests {
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.datasource.initialize:true",
|
||||
"spring.datasource.schema:"
|
||||
+ ClassUtils.addResourcePathToPackagePath(getClass(),
|
||||
"schema.sql"),
|
||||
"spring.datasource.schema:" + ClassUtils
|
||||
.addResourcePathToPackagePath(getClass(), "schema.sql"),
|
||||
"spring.datasource.data:classpath:does/not/exist.sql");
|
||||
|
||||
this.thrown.expect(BeanCreationException.class);
|
||||
|
@ -67,14 +67,15 @@ public class ValidationAutoConfigurationTests {
|
||||
public void userDefinedMethodValidationPostProcessorTakesPrecedence() {
|
||||
load(SampleConfiguration.class);
|
||||
assertThat(this.context.getBeansOfType(Validator.class)).hasSize(1);
|
||||
Object userMethodValidationPostProcessor =
|
||||
this.context.getBean("testMethodValidationPostProcessor");
|
||||
Object userMethodValidationPostProcessor = this.context
|
||||
.getBean("testMethodValidationPostProcessor");
|
||||
assertThat(this.context.getBean(MethodValidationPostProcessor.class))
|
||||
.isSameAs(userMethodValidationPostProcessor);
|
||||
assertThat(this.context.getBeansOfType(MethodValidationPostProcessor.class))
|
||||
.hasSize(1);
|
||||
assertThat(this.context.getBean(Validator.class)).isNotSameAs(
|
||||
new DirectFieldAccessor(userMethodValidationPostProcessor).getPropertyValue("validator"));
|
||||
assertThat(this.context.getBean(Validator.class))
|
||||
.isNotSameAs(new DirectFieldAccessor(userMethodValidationPostProcessor)
|
||||
.getPropertyValue("validator"));
|
||||
}
|
||||
|
||||
public void load(Class<?> config) {
|
||||
|
@ -36,7 +36,8 @@ public class DependencyResolutionContextTests {
|
||||
@Test
|
||||
public void canAddSpringBootDependencies() {
|
||||
DependencyResolutionContext dependencyResolutionContext = new DependencyResolutionContext();
|
||||
dependencyResolutionContext.addDependencyManagement(new SpringBootDependenciesDependencyManagement());
|
||||
dependencyResolutionContext.addDependencyManagement(
|
||||
new SpringBootDependenciesDependencyManagement());
|
||||
assertThat(dependencyResolutionContext.getManagedDependencies()).isNotEmpty();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = {"endpoints.hypermedia.enabled: true", "management.security.enabled: false"})
|
||||
@TestPropertySource(properties = { "endpoints.hypermedia.enabled: true",
|
||||
"management.security.enabled: false" })
|
||||
public class SampleHypermediaGsonApplicationTests {
|
||||
|
||||
@Autowired
|
||||
|
@ -73,8 +73,8 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
|
||||
@Override
|
||||
public void init(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.inMemoryAuthentication().withUser("admin").password("admin")
|
||||
.roles("ADMIN", "USER", "ACTUATOR").and().withUser("user").password("user")
|
||||
.roles("USER");
|
||||
.roles("ADMIN", "USER", "ACTUATOR").and().withUser("user")
|
||||
.password("user").roles("USER");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ import java.lang.annotation.Target;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
|
||||
/**
|
||||
* {@link ImportAutoConfiguration Auto-configuration imports} for typical jdbc tests.
|
||||
* Most tests should consider using {@link JdbcTest @JdbcTest} rather than using
|
||||
* this annotation directly.
|
||||
* {@link ImportAutoConfiguration Auto-configuration imports} for typical jdbc tests. Most
|
||||
* tests should consider using {@link JdbcTest @JdbcTest} rather than using this
|
||||
* annotation directly.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 1.5.0
|
||||
@ -38,4 +38,5 @@ import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
@Documented
|
||||
@ImportAutoConfiguration
|
||||
public @interface AutoConfigureJdbc {
|
||||
|
||||
}
|
||||
|
@ -49,10 +49,10 @@ class JdbcTypeExcludeFilter extends AnnotationCustomizableTypeExcludeFilter {
|
||||
@Override
|
||||
protected ComponentScan.Filter[] getFilters(FilterType type) {
|
||||
switch (type) {
|
||||
case INCLUDE:
|
||||
return this.annotation.includeFilters();
|
||||
case EXCLUDE:
|
||||
return this.annotation.excludeFilters();
|
||||
case INCLUDE:
|
||||
return this.annotation.includeFilters();
|
||||
case EXCLUDE:
|
||||
return this.annotation.excludeFilters();
|
||||
}
|
||||
throw new IllegalStateException("Unsupported type " + type);
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
|
||||
* instead of any application defined or auto-configured {@link DataSource}.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @deprecated since 1.5 in favour of {@link org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase}
|
||||
* @deprecated since 1.5 in favour of
|
||||
* {@link org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase}
|
||||
*/
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
@ -62,16 +62,14 @@ public class AutoConfigureTestDatabaseWithMultipleDatasourcesIntegrationTests {
|
||||
@Primary
|
||||
public DataSource dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseType.HSQL);
|
||||
.generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource secondaryDataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseType.HSQL);
|
||||
.generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,7 @@ public class ExampleJdbcApplication {
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseType.HSQL);
|
||||
.generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -49,8 +49,9 @@ public class ExampleRepository {
|
||||
}
|
||||
|
||||
public ExampleEntity findById(int id) {
|
||||
return this.jdbcTemplate.queryForObject("select id, name from example where id =?",
|
||||
new Object[] { id }, ROW_MAPPER);
|
||||
return this.jdbcTemplate.queryForObject(
|
||||
"select id, name from example where id =?", new Object[] { id },
|
||||
ROW_MAPPER);
|
||||
}
|
||||
|
||||
public Collection<ExampleEntity> findAll() {
|
||||
@ -65,6 +66,7 @@ public class ExampleRepository {
|
||||
String name = rs.getString("name");
|
||||
return new ExampleEntity(id, name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -61,8 +61,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplaceExplicitIntegrationTest
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseType.H2);
|
||||
.generateUniqueName(true).setType(EmbeddedDatabaseType.H2);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -63,8 +63,7 @@ public class JdbcTestWithAutoConfigureTestDatabaseReplacePropertyAnyIntegrationT
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseType.H2);
|
||||
.generateUniqueName(true).setType(EmbeddedDatabaseType.H2);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -93,8 +93,7 @@ public class TestDatabaseAutoConfigurationTests {
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseType.HSQL);
|
||||
.generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,7 @@ public class DataJpaTestWithAutoConfigureTestDatabaseReplaceExplicitIntegrationT
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseType.H2);
|
||||
.generateUniqueName(true).setType(EmbeddedDatabaseType.H2);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,7 @@ public class ExampleDataJpaApplication {
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.generateUniqueName(true)
|
||||
.setType(EmbeddedDatabaseType.HSQL);
|
||||
.generateUniqueName(true).setType(EmbeddedDatabaseType.HSQL);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,7 @@ public class WebMvcTestAllControllersIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void shouldRunValidationSuccess() throws Exception {
|
||||
this.mvc.perform(get("/three/OK"))
|
||||
.andExpect(status().isOk())
|
||||
this.mvc.perform(get("/three/OK")).andExpect(status().isOk())
|
||||
.andExpect(content().string("Hello OK"));
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,8 @@ class TypeElementMembers {
|
||||
|
||||
private final FieldValuesParser fieldValuesParser;
|
||||
|
||||
TypeElementMembers(ProcessingEnvironment env, FieldValuesParser fieldValuesParser, TypeElement element) {
|
||||
TypeElementMembers(ProcessingEnvironment env, FieldValuesParser fieldValuesParser,
|
||||
TypeElement element) {
|
||||
this.env = env;
|
||||
this.typeUtils = new TypeUtils(this.env);
|
||||
this.fieldValuesParser = fieldValuesParser;
|
||||
|
@ -357,10 +357,18 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
||||
ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("nestedChildProps")
|
||||
.fromSource(ClassWithNestedProperties.NestedChildClass.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("nestedChildProps.child-class-property", Integer.class)
|
||||
.fromSource(ClassWithNestedProperties.NestedChildClass.class).withDefaultValue(20));
|
||||
assertThat(metadata).has(Metadata.withProperty("nestedChildProps.parent-class-property", Integer.class)
|
||||
.fromSource(ClassWithNestedProperties.NestedChildClass.class).withDefaultValue(10));
|
||||
assertThat(metadata)
|
||||
.has(Metadata
|
||||
.withProperty("nestedChildProps.child-class-property",
|
||||
Integer.class)
|
||||
.fromSource(ClassWithNestedProperties.NestedChildClass.class)
|
||||
.withDefaultValue(20));
|
||||
assertThat(metadata)
|
||||
.has(Metadata
|
||||
.withProperty("nestedChildProps.parent-class-property",
|
||||
Integer.class)
|
||||
.fromSource(ClassWithNestedProperties.NestedChildClass.class)
|
||||
.withDefaultValue(10));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -52,6 +52,7 @@ public class DeprecatedMethodConfig {
|
||||
public void setFlag(boolean flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public class ClassWithNestedProperties {
|
||||
public void setParentClassProperty(int parentClassProperty) {
|
||||
this.parentClassProperty = parentClassProperty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ConfigurationProperties(prefix = "nestedChildProps")
|
||||
@ -50,5 +51,7 @@ public class ClassWithNestedProperties {
|
||||
public void setChildClassProperty(int childClassProperty) {
|
||||
this.childClassProperty = childClassProperty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -392,7 +392,6 @@ public abstract class MainClassFinder {
|
||||
* Creates a new {@code MainClass} rather represents the main class with the given
|
||||
* {@code name}. The class is annotated with the annotations with the given
|
||||
* {@code annotationNames}.
|
||||
*
|
||||
* @param name the name of the class
|
||||
* @param annotationNames the names of the annotations on the class
|
||||
*/
|
||||
|
@ -65,7 +65,8 @@ public class ExplodedArchive implements Archive {
|
||||
* Create a new {@link ExplodedArchive} instance.
|
||||
* @param root the root folder
|
||||
* @param recursive if recursive searching should be used to locate the manifest.
|
||||
* Defaults to {@code true}, folders with a large tree might want to set this to {@code
|
||||
* Defaults to {@code true}, folders with a large tree might want to set this to
|
||||
* {@code
|
||||
* false}.
|
||||
*/
|
||||
public ExplodedArchive(File root, boolean recursive) {
|
||||
|
@ -412,8 +412,8 @@ public class UndertowEmbeddedServletContainerFactory
|
||||
String prefix = (this.accessLogPrefix != null ? this.accessLogPrefix
|
||||
: "access_log.");
|
||||
AccessLogReceiver accessLogReceiver = new DefaultAccessLogReceiver(
|
||||
createWorker(), this.accessLogDirectory, prefix,
|
||||
this.accessLogSuffix, this.accessLogRotate);
|
||||
createWorker(), this.accessLogDirectory, prefix, this.accessLogSuffix,
|
||||
this.accessLogRotate);
|
||||
String formatString = (this.accessLogPattern != null) ? this.accessLogPattern
|
||||
: "common";
|
||||
return new AccessLogHandler(handler, accessLogReceiver, formatString,
|
||||
|
@ -164,7 +164,7 @@ public enum DatabaseDriver {
|
||||
* Informix.
|
||||
*/
|
||||
INFORMIX("informix", "Informix Dynamic Server", "com.informix.jdbc.IfxDriver", null,
|
||||
"select count(*) from systables") {
|
||||
"select count(*) from systables") {
|
||||
|
||||
@Override
|
||||
protected Collection<String> getUrlPrefixes() {
|
||||
|
@ -184,6 +184,7 @@ public abstract class AbstractLoggingSystem extends LoggingSystem {
|
||||
|
||||
/**
|
||||
* Maintains a mapping between native levels and {@link LogLevel}.
|
||||
*
|
||||
* @param <T> The native level type
|
||||
*/
|
||||
protected static class LogLevels<T> {
|
||||
|
@ -48,9 +48,9 @@ public abstract class LoggingSystem {
|
||||
public static final String NONE = "none";
|
||||
|
||||
/**
|
||||
* The name used for the root logger. LoggingSystem implementations should ensure
|
||||
* that this is the name used to represent the root logger, regardless of the
|
||||
* underlying implementation.
|
||||
* The name used for the root logger. LoggingSystem implementations should ensure that
|
||||
* this is the name used to represent the root logger, regardless of the underlying
|
||||
* implementation.
|
||||
*/
|
||||
public static final String ROOT_LOGGER_NAME = "ROOT";
|
||||
|
||||
|
@ -75,16 +75,15 @@ public class SpringPhysicalNamingStrategy implements PhysicalNamingStrategy {
|
||||
}
|
||||
|
||||
String text = builder.toString();
|
||||
String finalText = isCaseInsensitive(jdbcEnvironment) ? text.toLowerCase(Locale.ROOT)
|
||||
: text;
|
||||
String finalText = isCaseInsensitive(jdbcEnvironment)
|
||||
? text.toLowerCase(Locale.ROOT) : text;
|
||||
return new Identifier(finalText, name.isQuoted());
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify whether the database is case sensitive.
|
||||
* @param jdbcEnvironment The JDBC environment which can be used to determine case
|
||||
* @return true if the database is case insensitive
|
||||
* sensitivity
|
||||
* @return true if the database is case insensitive sensitivity
|
||||
*/
|
||||
protected boolean isCaseInsensitive(JdbcEnvironment jdbcEnvironment) {
|
||||
return true;
|
||||
|
@ -699,6 +699,7 @@ public class EnableConfigurationPropertiesTests {
|
||||
}
|
||||
|
||||
// No getter - you should be able to bind to a write-only bean
|
||||
|
||||
}
|
||||
|
||||
// No annotation
|
||||
|
@ -176,7 +176,8 @@ public class JavaLoggingSystemTests extends AbstractLoggingSystemTests {
|
||||
List<LoggerConfiguration> configurations = this.loggingSystem
|
||||
.getLoggerConfigurations();
|
||||
assertThat(configurations).isNotEmpty();
|
||||
assertThat(configurations.get(0).getName()).isEqualTo(LoggingSystem.ROOT_LOGGER_NAME);
|
||||
assertThat(configurations.get(0).getName())
|
||||
.isEqualTo(LoggingSystem.ROOT_LOGGER_NAME);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -70,13 +70,14 @@ public class SpringPhysicalNamingStrategyTests {
|
||||
@Test
|
||||
public void tableNameShouldNotBeLowerCaseIfCaseSensitive() throws Exception {
|
||||
this.metadata = this.metadataSources.getMetadataBuilder(this.serviceRegistry)
|
||||
.applyPhysicalNamingStrategy(new TestSpringPhysicalNamingStrategy()).build();
|
||||
.applyPhysicalNamingStrategy(new TestSpringPhysicalNamingStrategy())
|
||||
.build();
|
||||
PersistentClass binding = this.metadata
|
||||
.getEntityBinding(TelephoneNumber.class.getName());
|
||||
assertThat(binding.getTable().getQuotedName()).isEqualTo("Telephone_Number");
|
||||
}
|
||||
|
||||
private class TestSpringPhysicalNamingStrategy extends SpringPhysicalNamingStrategy {
|
||||
private class TestSpringPhysicalNamingStrategy extends SpringPhysicalNamingStrategy {
|
||||
|
||||
@Override
|
||||
protected boolean isCaseInsensitive(JdbcEnvironment jdbcEnvironment) {
|
||||
@ -84,4 +85,5 @@ public class SpringPhysicalNamingStrategyTests {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user