Commit 179e1558 authored by Phillip Webb's avatar Phillip Webb

Polish

parent 2433f721
......@@ -33,7 +33,7 @@ import org.springframework.core.type.AnnotationMetadata;
* be registered via the inner {@link Registrar} class.
*
* @author Dave Syer
* @since 1.1.0
* @since 1.1.2
*/
class DataSourceInitializerPostProcessor implements BeanPostProcessor {
......@@ -78,6 +78,7 @@ class DataSourceInitializerPostProcessor implements BeanPostProcessor {
registry.registerBeanDefinition(BEAN_NAME, beanDefinition);
}
}
}
}
......@@ -16,14 +16,14 @@
package org.springframework.boot.gradle;
import static org.junit.Assert.assertNotNull;
import java.util.jar.JarFile;
import org.gradle.tooling.ProjectConnection;
import org.junit.Test;
import org.springframework.boot.dependency.tools.ManagedDependencies;
import static org.junit.Assert.assertNotNull;
/**
* Tests for using the Gradle plugin's support for installing artifacts
*
......@@ -33,22 +33,23 @@ public class ClassifierTests {
private ProjectConnection project;
private static final String BOOT_VERSION = ManagedDependencies.get().find(
"spring-boot").getVersion();
private static final String BOOT_VERSION = ManagedDependencies.get()
.find("spring-boot").getVersion();
@Test
public void classifierInBootTask() throws Exception {
project = new ProjectCreator().createProject("classifier");
project.newBuild().forTasks("build").withArguments(
"-PbootVersion=" + BOOT_VERSION, "--stacktrace").run();
this.project = new ProjectCreator().createProject("classifier");
this.project.newBuild().forTasks("build")
.withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace").run();
checkFilesExist("classifier");
}
@Test
public void classifierInBootExtension() throws Exception {
project = new ProjectCreator().createProject("classifier-extension");
project.newBuild().forTasks("build").withArguments(
"-PbootVersion=" + BOOT_VERSION, "--stacktrace", "--info").run();
this.project = new ProjectCreator().createProject("classifier-extension");
this.project.newBuild().forTasks("build")
.withArguments("-PbootVersion=" + BOOT_VERSION, "--stacktrace", "--info")
.run();
}
private void checkFilesExist(String name) throws Exception {
......
......@@ -89,18 +89,17 @@ public class SampleWebSecureApplication extends WebMvcConfigurerAdapter {
}
@Order(Ordered.HIGHEST_PRECEDENCE + 10)
protected static class AuthenticationSecurity extends GlobalAuthenticationConfigurerAdapter {
protected static class AuthenticationSecurity extends
GlobalAuthenticationConfigurerAdapter {
@Autowired
private DataSource dataSource;
@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth.jdbcAuthentication().dataSource(dataSource).withUser("admin").password("admin")
.roles("ADMIN", "USER").and().withUser("user").password("user")
.roles("USER");
// @formatter:on
auth.jdbcAuthentication().dataSource(this.dataSource).withUser("admin")
.password("admin").roles("ADMIN", "USER").and().withUser("user")
.password("user").roles("USER");
}
}
......
......@@ -89,9 +89,9 @@ public class RepackagePluginFeatures implements PluginFeatures {
@Override
public void execute(Jar archive) {
if ("".equals(archive.getClassifier())) {
setClassifier(task, archive);
setClassifier(this.task, archive);
File file = archive.getArchivePath();
String classifier = task.getClassifier();
String classifier = this.task.getClassifier();
if (classifier != null) {
String withClassifer = file.getName();
withClassifer = StringUtils.stripFilenameExtension(withClassifer)
......@@ -99,8 +99,8 @@ public class RepackagePluginFeatures implements PluginFeatures {
+ StringUtils.getFilenameExtension(withClassifer);
File out = new File(file.getParentFile(), withClassifer);
file = out;
task.getOutputs().file(file);
task.setOutputFile(file);
this.task.getOutputs().file(file);
this.task.setOutputFile(file);
}
}
......
......@@ -120,8 +120,8 @@ public class RepackageTask extends DefaultTask {
try {
FileCopyUtils.copy(file, out);
}
catch (IOException e) {
throw new IllegalStateException(e.getMessage(), e);
catch (IOException ex) {
throw new IllegalStateException(ex.getMessage(), ex);
}
file = out;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment