Skip to content

Commit a73c6d9

Browse files
committed
Spring Boot 1.1.0
Previously, auto-reconfiguration did not work on Spring Boot applications. With the upcoming releases of Spring Boot 1.1.0.RELEASE and Java Buildpack Auto-reconfiguration 1.0.0.RELEASE, this will no longer be the case. This change updates the buildpack to work with Spring Boot 1.1.0.RELEASE and later. [#49695439]
1 parent 8d65af3 commit a73c6d9

File tree

5 files changed

+7
-29
lines changed

5 files changed

+7
-29
lines changed

config/spring_boot_cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
# Note that the repository is shared with the Play Auto Reconfiguration framework and should be kept in step to
1818
# avoid conflicts.
1919
---
20-
version: 1.0.0_+
20+
version: 1.1.+
2121
repository_root: "{default.repository.root}/spring-boot-cli"

lib/java_buildpack/buildpack.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def release
8282
'default_process_types' => { 'web' => command }
8383
}.to_yaml
8484

85-
@logger.debug { "Release Payload\n#{payload}" }
85+
@logger.debug { "Release Payload:\n#{payload}" }
8686

8787
payload
8888
end

lib/java_buildpack/container/spring_boot_cli.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def initialize(context)
4141
# (see JavaBuildpack::Component::BaseComponent#compile)
4242
def compile
4343
download_tar
44-
@droplet.additional_libraries.link_to lib_dir
4544
end
4645

4746
# (see JavaBuildpack::Component::BaseComponent#release)
@@ -52,6 +51,7 @@ def release
5251
'SERVER_PORT=$PORT',
5352
qualify_path(@droplet.sandbox + 'bin/spring', @droplet.root),
5453
'run',
54+
@droplet.additional_libraries.as_classpath,
5555
relative_groovy_files
5656
].flatten.compact.join(' ')
5757
end
@@ -66,10 +66,6 @@ def supports?
6666

6767
private
6868

69-
def lib_dir
70-
@droplet.sandbox + 'lib'
71-
end
72-
7369
def relative_groovy_files
7470
JavaBuildpack::Util::GroovyUtils.groovy_files(@application).map { |gf| gf.relative_path_from(@application.root) }
7571
end

lib/java_buildpack/util/spring_boot_utils.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module Util
2525
class SpringBootUtils < JarFinder
2626

2727
def initialize
28-
super(/.*spring-boot-([^-]*)\.jar/)
28+
super(/.*spring-boot-([\d].*)\.jar/)
2929
end
3030

3131
end

spec/java_buildpack/container/spring_boot_cli_spec.rb

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -84,31 +84,13 @@
8484
expect(sandbox + 'bin/spring').to exist
8585
end
8686

87-
it 'should link classpath JARs',
88-
app_fixture: 'container_spring_boot_cli_valid_app',
89-
cache_fixture: 'stub-spring-boot-cli.tar.gz' do
90-
91-
component.compile
92-
93-
lib = sandbox + 'lib'
94-
95-
jar_1 = lib + 'test-jar-1.jar'
96-
expect(jar_1).to exist
97-
expect(jar_1).to be_symlink
98-
expect(jar_1.readlink).to eq((additional_libs_directory + 'test-jar-1.jar').relative_path_from(lib))
99-
100-
jar_2 = lib + 'test-jar-2.jar'
101-
expect(jar_2).to exist
102-
expect(jar_2).to be_symlink
103-
expect(jar_2.readlink).to eq((additional_libs_directory + 'test-jar-2.jar').relative_path_from(lib))
104-
end
105-
10687
it 'should return command',
10788
app_fixture: 'container_spring_boot_cli_valid_app' do
10889

10990
expect(component.release).to eq("#{java_home.as_env_var} JAVA_OPTS=#{java_opts_str} SERVER_PORT=$PORT " \
110-
'$PWD/.java-buildpack/spring_boot_cli/bin/spring run directory/pogo_4.groovy ' \
111-
'invalid.groovy pogo_1.groovy pogo_2.groovy pogo_3.groovy')
91+
'$PWD/.java-buildpack/spring_boot_cli/bin/spring run ' \
92+
'-cp $PWD/.additional_libs/test-jar-1.jar:$PWD/.additional_libs/test-jar-2.jar ' \
93+
'directory/pogo_4.groovy invalid.groovy pogo_1.groovy pogo_2.groovy pogo_3.groovy')
11294
end
11395

11496
def java_opts_str

0 commit comments

Comments
 (0)