private ExtendedGroovyClassLoader createLoader( GroovyCompilerConfiguration configuration) { ExtendedGroovyClassLoader loader = new ExtendedGroovyClassLoader( configuration.getScope()); for (URL url : getExistingUrls()) { loader.addURL(url); } for (String classpath : configuration.getClasspath()) { loader.addClasspath(classpath); } return loader; }
@Override public void applyDependencies(DependencyCustomizer dependencies) { dependencies.ifAnyMissingClasses("org.springframework.jdbc.core.JdbcTemplate") .add("spring-boot-starter-jdbc"); }
protected OptionSetGroovyCompilerConfiguration(OptionSet optionSet, CompilerOptionHandler compilerOptionHandler) { this(optionSet, compilerOptionHandler, RepositoryConfigurationFactory.createDefaultRepositoryConfiguration()); }
@Override public boolean matches(ClassNode classNode) { return AstUtils.hasAtLeastOneInterface(classNode, SOURCE_INTERFACE) || AstUtils.hasAtLeastOneAnnotation(classNode, "EnableRatpack"); }
/** * Add a single dependency and, optionally, all of its dependencies. The group ID and * version of the dependency are resolved from the module using the customizer's * {@link ArtifactCoordinatesResolver}. * @param module the module ID * @param transitive {@code true} if the transitive dependencies should also be added, * otherwise {@code false} * @return this {@link DependencyCustomizer} for continued use */ public DependencyCustomizer add(String module, boolean transitive) { return add(module, null, null, transitive); }
@Override public boolean matches(ClassNode classNode) { return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableIntegration") || AstUtils.hasAtLeastOneAnnotation(classNode, "MessageEndpoint"); }
/** * Extract a top-level <code>ratpack{}</code> closure from inside this block if * there is one. Removes it from the block at the same time. * @param block a block statement (class definition) * @return a beans Closure if one can be found, null otherwise */ private ClosureExpression ratpack(BlockStatement block) { return AstUtils.getClosure(block, RATPACK, true); } }
@SuppressWarnings("rawtypes") private void addAstTransformations(CompilationUnit compilationUnit) { LinkedList[] phaseOperations = getPhaseOperations(compilationUnit); processConversionOperations(phaseOperations[Phases.CONVERSION]); }
@Override public void visit(ASTNode[] nodes, SourceUnit source) { for (ASTNode astNode : nodes) { if (astNode instanceof ModuleNode) { visitModule((ModuleNode) astNode, getBomModule()); } } }
@Override public boolean matches(ClassNode classNode) { return AstUtils.hasAtLeastOneFieldOrMethod(classNode, "JdbcTemplate", "NamedParameterJdbcTemplate", "DataSource"); }
@Override public void applyDependencies(DependencyCustomizer dependencies) { dependencies .ifAnyMissingClasses( "org.springframework.cloud.stream.binder.kafka.config.KafkaServiceAutoConfiguration") .add("spring-cloud-starter-stream-kafka"); }
@Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { dependencies.add("spring-rabbit"); }
private static GroovyCompilerConfiguration createCompilerConfiguration( OptionSet options, CompilerOptionHandler compilerOptionHandler) { List<RepositoryConfiguration> repositoryConfiguration = RepositoryConfigurationFactory .createDefaultRepositoryConfiguration(); return new OptionSetGroovyCompilerConfiguration(options, compilerOptionHandler, repositoryConfiguration) { @Override public boolean isAutoconfigure() { return false; } }; }
/** * Extract a top-level <code>beans{}</code> closure from inside this block if * there is one. Removes it from the block at the same time. * @param block a block statement (class definition) * @return a beans Closure if one can be found, null otherwise */ private ClosureExpression beans(BlockStatement block) { return AstUtils.getClosure(block, BEANS, true); }
@Override public void applyDependencies(DependencyCustomizer dependencies) { dependencies.ifAnyMissingClasses("org.springframework.web.servlet.mvc.Controller") .add("spring-boot-starter-web"); dependencies.ifAnyMissingClasses("groovy.text.TemplateEngine") .add("groovy-templates"); }
@Override public void applyDependencies(DependencyCustomizer dependencies) throws CompilationFailedException { dependencies.add("spring-jms", "javax.jms-api"); }
@Override public void applyDependencies(DependencyCustomizer dependencies) { dependencies .ifAnyMissingClasses( "org.springframework.integration.config.EnableIntegration") .add("spring-boot-starter-integration"); }
@Override public void applyDependencies(DependencyCustomizer dependencies) { dependencies .ifAnyMissingClasses( "org.springframework.transaction.annotation.Transactional") .add("spring-tx", "spring-boot-starter-aop"); }
@Override public void applyDependencies(DependencyCustomizer dependencies) { dependencies.ifAnyMissingClasses("org.springframework.boot.SpringApplication") .add("spring-boot-starter"); }
@Override public void applyDependencies(DependencyCustomizer dependencies) { dependencies.ifAnyMissingClasses("org.springframework.batch.core.Job") .add("spring-boot-starter-batch"); dependencies.ifAnyMissingClasses("org.springframework.jdbc.core.JdbcTemplate") .add("spring-jdbc"); }