Skip to content

Commit

Permalink
Allow package-private main classes to be used with Devtools
Browse files Browse the repository at this point in the history
Fixes gh-35858
  • Loading branch information
wilkinsona committed Jun 13, 2023
1 parent ad0ce41 commit 984dc1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.springframework.boot.web.context.WebServerPortFileWriter;

@SpringBootApplication
public class DevToolsTestApplication {
class DevToolsTestApplication {

public static void main(String[] args) {
new SpringApplicationBuilder(DevToolsTestApplication.class).listeners(new WebServerPortFileWriter(args[0]))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2023 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.
Expand Down Expand Up @@ -46,6 +46,7 @@ public void run() {
try {
Class<?> mainClass = Class.forName(this.mainClassName, false, getContextClassLoader());
Method mainMethod = mainClass.getDeclaredMethod("main", String[].class);
mainMethod.setAccessible(true);
mainMethod.invoke(null, new Object[] { this.args });
}
catch (Throwable ex) {
Expand Down
1 change: 1 addition & 0 deletions src/checkstyle/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<suppress files="DeprecatedElasticsearchRestClientProperties\.java" checks="SpringMethodVisibility" />
<suppress files="DeprecatedElasticsearchRestClientProperties\.java" checks="SpringMethodVisibility" />
<suppress files="DeprecatedReactiveElasticsearchRestClientProperties\.java" checks="SpringMethodVisibility" />
<suppress files="DevToolsTestApplication\.java" checks="SpringMethodVisibility" />
<suppress files="DevToolsR2dbcAutoConfigurationTests" checks="HideUtilityClassConstructor" />
<suppress files="AbstractLaunchScriptIntegrationTests" checks="IllegalImport" />
<suppress files="SpringBootVersion" checks="JavadocPackage" />
Expand Down

0 comments on commit 984dc1d

Please sign in to comment.