This is an automated email from the ASF dual-hosted git repository.

jamesbognar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juneau.git


The following commit(s) were added to refs/heads/master by this push:
     new 99fd248e7 Upgrade to Spring Boot 2.7.0 and Servlet 4.0.1.
99fd248e7 is described below

commit 99fd248e73ee1dcc342d772e2c5be6000db67395
Author: JamesBognar <james.bog...@salesforce.com>
AuthorDate: Sat Jun 18 07:18:58 2022 -0400

    Upgrade to Spring Boot 2.7.0 and Servlet 4.0.1.
---
 .../juneau-examples-rest-springboot.launch         |  5 ++++-
 .../juneau-examples-rest-springboot/pom.xml        |  6 +++++-
 .../juneau/examples/rest/springboot/App.java       | 22 ++++++----------------
 .../examples/rest/springboot/RootResources.java    |  3 +++
 .../src/main/resources/juneau.cfg                  |  2 +-
 .../juneau/rest/springboot/SpringBeanStore.java    | 18 +++++++++++++++++-
 pom.xml                                            |  4 ++--
 7 files changed, 38 insertions(+), 22 deletions(-)

diff --git 
a/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
 
b/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
index 29e66fcb9..35cab1ceb 100644
--- 
a/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
+++ 
b/juneau-examples/juneau-examples-rest-springboot/juneau-examples-rest-springboot.launch
@@ -8,10 +8,13 @@
     </listAttribute>
     <booleanAttribute key="org.eclipse.jdt.debug.ui.CONSIDER_INHERITED_MAIN" 
value="true"/>
     <booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" 
value="true"/>
+    <booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" 
value="false"/>
+    <booleanAttribute 
key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
     <booleanAttribute 
key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
     <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" 
value="org.eclipse.m2e.launchconfig.classpathProvider"/>
-    <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" 
value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+    <stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" 
value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
     <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" 
value="org.apache.juneau.examples.rest.springboot.App"/>
+    <stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" 
value="juneau-examples-rest-springboot"/>
     <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" 
value="juneau-examples-rest-springboot"/>
     <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" 
value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
 </launchConfiguration>
diff --git a/juneau-examples/juneau-examples-rest-springboot/pom.xml 
b/juneau-examples/juneau-examples-rest-springboot/pom.xml
index e0b414c49..de1d2efcb 100644
--- a/juneau-examples/juneau-examples-rest-springboot/pom.xml
+++ b/juneau-examples/juneau-examples-rest-springboot/pom.xml
@@ -39,7 +39,6 @@
                <maven.compiler.target>1.8</maven.compiler.target>
        </properties>
 
-
        <dependencies>
                <!-- Juneau dependencies -->
                <dependency>
@@ -53,6 +52,11 @@
                        <artifactId>juneau-rest-server-springboot</artifactId>
                        <version>${project.version}</version>
                </dependency>
+                       <dependency>
+                               <groupId>javax.xml.bind</groupId>
+                               <artifactId>jaxb-api</artifactId>
+                               <scope>provided</scope>
+                       </dependency>
 
                <!-- Spring Boot dependencies -->
                <dependency>
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
 
b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
index 5d7878e3e..ca603ee1a 100644
--- 
a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
+++ 
b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/App.java
@@ -21,7 +21,6 @@ import org.springframework.boot.builder.*;
 import org.springframework.boot.web.servlet.*;
 import org.springframework.context.annotation.*;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.filter.*;
 
 /**
  * Entry point for Examples REST application when deployed as a Spring Boot 
application.
@@ -41,7 +40,12 @@ public class App {
         */
        @SuppressWarnings("resource")
        public static void main(String[] args) {
-               new SpringApplicationBuilder(App.class).run(args);
+               try {
+                       new SpringApplicationBuilder(App.class).run(args);
+                       System.out.println("Initialized.  App available on 
http://localhost:5000";);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
        }
 
        /**
@@ -87,18 +91,4 @@ public class App {
        public ServletRegistrationBean<Servlet> getRootServlet(RootResources 
rootResources) {
                return new ServletRegistrationBean<>(rootResources, "/*");
        }
-
-       /**
-        * We want to be able to consume url-encoded-form-post bodies, but 
HiddenHttpMethodFilter triggers the HTTP
-        * body to be consumed.  So disable it.
-        *
-        * @param filter The filter.
-        * @return Filter registration bean.
-        */
-       @Bean
-       public FilterRegistrationBean<HiddenHttpMethodFilter> 
registration(HiddenHttpMethodFilter filter) {
-               FilterRegistrationBean<HiddenHttpMethodFilter> registration = 
new FilterRegistrationBean<>(filter);
-               registration.setEnabled(false);
-               return registration;
-       }
 }
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/RootResources.java
 
b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/RootResources.java
index 8eec9d63c..d24eb65c1 100644
--- 
a/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/RootResources.java
+++ 
b/juneau-examples/juneau-examples-rest-springboot/src/main/java/org/apache/juneau/examples/rest/springboot/RootResources.java
@@ -12,6 +12,7 @@
 // 
***************************************************************************************************************************
 package org.apache.juneau.examples.rest.springboot;
 
+import org.apache.juneau.examples.rest.*;
 import org.apache.juneau.examples.rest.dto.*;
 import org.apache.juneau.html.annotation.*;
 import org.apache.juneau.microservice.resources.*;
@@ -38,6 +39,8 @@ import org.apache.juneau.serializer.annotation.*;
        children={
                HelloWorldResource.class,
                DtoExamples.class,
+               UtilityBeansResource.class,
+               HtmlBeansResource.class,
                ConfigResource.class,
                ShutdownResource.class
        }
diff --git 
a/juneau-examples/juneau-examples-rest-springboot/src/main/resources/juneau.cfg 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/juneau.cfg
index c18ac8cfc..6932e4b86 100755
--- 
a/juneau-examples/juneau-examples-rest-springboot/src/main/resources/juneau.cfg
+++ 
b/juneau-examples/juneau-examples-rest-springboot/src/main/resources/juneau.cfg
@@ -29,7 +29,7 @@ staticFiles = htdocs:htdocs
 # Stylesheet to use for HTML views.
 # Used by the BasicRestConfig interface that defines the following value:
 #      stylesheet="$C{REST/theme,servlet:/htdocs/themes/devops.css}"
-theme = servlet:/htdocs/themes/devops.css
+theme = servlet:/htdocs/themes/dark.css
 
 # Various look-and-feel settings used in the BasicRestConfig interface.
 headerIcon = servlet:/htdocs/images/juneau.png
diff --git 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringBeanStore.java
 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringBeanStore.java
index dc14eb446..ee3e03e63 100644
--- 
a/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringBeanStore.java
+++ 
b/juneau-rest/juneau-rest-server-springboot/src/main/java/org/apache/juneau/rest/springboot/SpringBeanStore.java
@@ -44,6 +44,21 @@ public class SpringBeanStore extends BeanStore {
                this.appContext = appContext;
        }
 
+       @Override
+       public <T> Optional<T> getBean(Class<T> c) {
+               try {
+                       Optional<T> o = super.getBean(c);
+                       if (o.isPresent())
+                               return o;
+                       if (appContext.isPresent()) {
+                               return 
optional(appContext.get().getBeanProvider(c).getIfAvailable());
+                       }
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+               return empty();
+       }
+
        @Override
        public <T> Optional<T> getBean(Class<T> c, String name) {
                try {
@@ -51,8 +66,9 @@ public class SpringBeanStore extends BeanStore {
                        if (o.isPresent())
                                return o;
                        if (appContext.isPresent()) {
+                               ApplicationContext ctx = appContext.get();
                                if (name != null)
-                                       return 
optional(appContext.get().getBean(name, c));
+                                       return optional(ctx.containsBean(name) 
? appContext.get().getBean(name, c) : null);
                                return optional(appContext.get().getBean(c));
                        }
                } catch (Exception e) {
diff --git a/pom.xml b/pom.xml
index b11ee4a89..c7bc966bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -39,7 +39,7 @@
                <jena.version>3.10.0</jena.version>
                <junit.version>4.11</junit.version>
                <jaxrs.version>1.1.1</jaxrs.version>
-               <servlet.version>3.1.0</servlet.version>
+               <servlet.version>4.0.1</servlet.version>
                <httpcore.version>4.4.13</httpcore.version>
                <httpclient.version>4.5.6</httpclient.version>
                <jetty.version>9.4.13.v20181111</jetty.version>
@@ -50,7 +50,7 @@
                <derby.version>10.10.2.0</derby.version>
                <hibernate.version>5.0.9.Final</hibernate.version>
                <javax.inject.version>1</javax.inject.version>
-               <springboot.version>2.4.2</springboot.version>
+               <springboot.version>2.7.0</springboot.version>
                <xml.apis.version>1.4.01</xml.apis.version>
                <javadoc.executable></javadoc.executable>
        </properties>

Reply via email to