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-petstore.git
The following commit(s) were added to refs/heads/master by this push: new a139982 Update to Juneau 9.0 a139982 is described below commit a139982f007b4aedd7b7ac1591feb5de64f2d5e6 Author: JamesBognar <james.bog...@salesforce.com> AuthorDate: Sun Jun 19 11:22:18 2022 -0400 Update to Juneau 9.0 --- juneau-petstore-api/pom.xml | 99 ++-- juneau-petstore-client/pom.xml | 110 +++-- juneau-petstore-server/pom.xml | 327 ++++++------- .../apache/juneau/petstore/AppConfiguration.java | 64 +-- .../petstore/config/SpringSecurityConfig.java | 39 -- .../juneau/petstore/rest/PetStoreResource.java | 7 +- .../apache/juneau/petstore/rest/RootResources.java | 13 +- pom.xml | 515 ++++++++++----------- 8 files changed, 523 insertions(+), 651 deletions(-) diff --git a/juneau-petstore-api/pom.xml b/juneau-petstore-api/pom.xml index b320d95..5f5155c 100755 --- a/juneau-petstore-api/pom.xml +++ b/juneau-petstore-api/pom.xml @@ -2,51 +2,50 @@ <!-- *************************************************************************************************************************** * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * + * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations under the License. * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations under the License. * *************************************************************************************************************************** --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.juneau.petstore</groupId> - <artifactId>juneau-petstore</artifactId> - <version>8.2.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.apache.juneau.petstore</groupId> + <artifactId>juneau-petstore</artifactId> + <version>8.2.0-SNAPSHOT</version> + </parent> - <artifactId>juneau-petstore-api</artifactId> - <name>Apache Juneau Petstore Example - Common API</name> - <description>Apache Juneau Petstore Example, Common API</description> + <artifactId>juneau-petstore-api</artifactId> + <name>Apache Juneau Petstore Example - Common API</name> + <description>Apache Juneau Petstore Example, Common API</description> - <properties> - <encoding>UTF-8</encoding> - <maven.javadoc.skip>true</maven.javadoc.skip> + <properties> + <encoding>UTF-8</encoding> + <maven.javadoc.skip>true</maven.javadoc.skip> - <!-- Skip javadoc generation since we generate them in the aggregate pom --> - <maven.javadoc.skip>true</maven.javadoc.skip> + <!-- Skip javadoc generation since we generate them in the aggregate pom --> + <maven.javadoc.skip>true</maven.javadoc.skip> - <!-- Java 8 required because Jetty requires it. --> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - </properties> + <maven.compiler.source>18</maven.compiler.source> + <maven.compiler.target>18</maven.compiler.target> + </properties> - <dependencies> + <dependencies> - <dependency> - <groupId>org.apache.juneau</groupId> - <artifactId>juneau-marshall</artifactId> - <version>${juneau.version}</version> - </dependency> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-marshall</artifactId> + <version>${juneau.version}</version> + </dependency> <!-- Needed for JPA persistence annotations --> <dependency> @@ -55,24 +54,24 @@ <version>${hibernate.version}</version> </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <id>attach-sources</id> - <phase>verify</phase> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <phase>verify</phase> + <goals> + <goal>jar-no-fork</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/juneau-petstore-client/pom.xml b/juneau-petstore-client/pom.xml index 9645c48..353fbe4 100755 --- a/juneau-petstore-client/pom.xml +++ b/juneau-petstore-client/pom.xml @@ -2,77 +2,75 @@ <!-- *************************************************************************************************************************** * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * + * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations under the License. * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations under the License. * *************************************************************************************************************************** --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.juneau.petstore</groupId> - <artifactId>juneau-petstore</artifactId> - <version>8.2.0-SNAPSHOT</version> - </parent> + <parent> + <groupId>org.apache.juneau.petstore</groupId> + <artifactId>juneau-petstore</artifactId> + <version>8.2.0-SNAPSHOT</version> + </parent> - <artifactId>juneau-petstore-client</artifactId> - <name>Apache Juneau Petstore Example - Client Code</name> - <description>Apache Juneau Petstore Example, Client Code</description> + <artifactId>juneau-petstore-client</artifactId> + <name>Apache Juneau Petstore Example - Client Code</name> + <description>Apache Juneau Petstore Example, Client Code</description> - <properties> - <encoding>UTF-8</encoding> - <maven.javadoc.skip>true</maven.javadoc.skip> + <properties> + <encoding>UTF-8</encoding> - <!-- Skip javadoc generation since we generate them in the aggregate pom --> - <maven.javadoc.skip>true</maven.javadoc.skip> + <!-- Skip javadoc generation since we generate them in the aggregate pom --> + <maven.javadoc.skip>true</maven.javadoc.skip> - <!-- Java 8 required because Jetty requires it. --> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - <springframework.version>2.0.1.RELEASE</springframework.version> - </properties> + <!-- Java 8 required because Jetty requires it. --> + <maven.compiler.source>18</maven.compiler.source> + <maven.compiler.target>18</maven.compiler.target> + </properties> - <dependencies> + <dependencies> - <dependency> - <groupId>org.apache.juneau.petstore</groupId> - <artifactId>juneau-petstore-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.juneau</groupId> - <artifactId>juneau-rest-client</artifactId> - <version>${juneau.version}</version> - </dependency> + <dependency> + <groupId>org.apache.juneau.petstore</groupId> + <artifactId>juneau-petstore-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-client</artifactId> + <version>${juneau.version}</version> + </dependency> - </dependencies> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <id>attach-sources</id> - <phase>verify</phase> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <phase>verify</phase> + <goals> + <goal>jar-no-fork</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/juneau-petstore-server/pom.xml b/juneau-petstore-server/pom.xml index d034034..c6ed179 100755 --- a/juneau-petstore-server/pom.xml +++ b/juneau-petstore-server/pom.xml @@ -2,206 +2,165 @@ <!-- *************************************************************************************************************************** * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * + * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations under the License. * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations under the License. * *************************************************************************************************************************** --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <version>8.2.0-SNAPSHOT</version> + <modelVersion>4.0.0</modelVersion> + <version>8.2.0-SNAPSHOT</version> - <parent> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-parent</artifactId> - <version>2.0.1.RELEASE</version> - <relativePath /> - </parent> + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>2.7.0</version> + <relativePath /> + </parent> - <artifactId>juneau-petstore-server</artifactId> - <name>Apache Juneau Petstore Example - Server Code</name> - <description>Apache Juneau Petstore Example, Server Code</description> + <artifactId>juneau-petstore-server</artifactId> + <name>Apache Juneau Petstore Example - Server Code</name> + <description>Apache Juneau Petstore Example, Server Code</description> - <properties> - <encoding>UTF-8</encoding> + <properties> + <encoding>UTF-8</encoding> - <!-- Skip javadoc generation since we generate them in the aggregate pom --> - <maven.javadoc.skip>true</maven.javadoc.skip> + <!-- Skip javadoc generation since we generate them in the aggregate pom --> + <maven.javadoc.skip>true</maven.javadoc.skip> - <!-- Java 8 required because Jetty requires it. --> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> + <!-- Java 8 required because Jetty requires it. --> + <maven.compiler.source>18</maven.compiler.source> + <maven.compiler.target>18</maven.compiler.target> - <maven.javadoc.skip>true</maven.javadoc.skip> + <maven.javadoc.skip>true</maven.javadoc.skip> - <juneau.version>8.2.0</juneau.version> - <javax.inject.version>1</javax.inject.version> - <servlet.version>3.1.0</servlet.version> - <hibernate.version>5.0.9.Final</hibernate.version> - </properties> + <juneau.version>8.2.0</juneau.version> + </properties> - <packaging>war</packaging> + <packaging>war</packaging> - <dependencies> - <!-- Juneau dependencies --> - <dependency> - <groupId>org.apache.juneau.petstore</groupId> - <artifactId>juneau-petstore-api</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.juneau</groupId> - <artifactId>juneau-rest-server-springboot</artifactId> - <version>${juneau.version}</version> - </dependency> - - - <!-- Needed for @Inject support --> + <dependencies> + <!-- Juneau dependencies --> <dependency> - <groupId>javax.inject</groupId> - <artifactId>javax.inject</artifactId> - <version>${javax.inject.version}</version> + <groupId>org.apache.juneau.petstore</groupId> + <artifactId>juneau-petstore-api</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-server-springboot</artifactId> + <version>${juneau.version}</version> </dependency> - <!-- Needed for JPA persistence of PetStore beans --> - <dependency> - <groupId>org.apache.derby</groupId> - <artifactId>derby</artifactId> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-core</artifactId> - </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-entitymanager</artifactId> - </dependency> - <dependency> - <groupId>xml-apis</groupId> - <artifactId>xml-apis</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-jpa</artifactId> - </dependency> - - <!-- Spring Security --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-security</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-config</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-core</artifactId> - <version>5.1.5.RELEASE</version> - </dependency> - - <!-- Cache --> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-cache</artifactId> - </dependency> - - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-test-autoconfigure</artifactId> - </dependency> - - <!-- Mock rest test --> - <dependency> - <groupId>org.apache.juneau</groupId> - <artifactId>juneau-rest-mock</artifactId> - <version>${juneau.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - <executions> - <execution> - <id>attach-sources</id> - <phase>verify</phase> - <goals> - <goal>jar-no-fork</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-jar-plugin</artifactId> - <extensions>true</extensions> - </plugin> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>build-info</goal> - </goals> - <configuration> - <additionalProperties> - <encoding.source>${project.build.sourceEncoding}</encoding.source> - <encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting> - <java.source>${maven.compiler.source}</java.source> - <java.target>${maven.compiler.target}</java.target> - </additionalProperties> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <executions> - <execution> - <id>copy-resources</id> - <phase>validate</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}</outputDirectory> - <resources> - <resource> - <directory>src/main/resources</directory> - <filtering>true</filtering> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> + <!-- Needed for JPA persistence of PetStore beans --> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-core</artifactId> + </dependency> + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-entitymanager</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-jpa</artifactId> + </dependency> + + <!-- Mock rest test --> + <dependency> + <groupId>org.apache.juneau</groupId> + <artifactId>juneau-rest-mock</artifactId> + <version>${juneau.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-source-plugin</artifactId> + <executions> + <execution> + <id>attach-sources</id> + <phase>verify</phase> + <goals> + <goal>jar-no-fork</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <extensions>true</extensions> + </plugin> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>build-info</goal> + </goals> + <configuration> + <additionalProperties> + <encoding.source>${project.build.sourceEncoding}</encoding.source> + <encoding.reporting>${project.reporting.outputEncoding}</encoding.reporting> + <java.source>${maven.compiler.source}</java.source> + <java.target>${maven.compiler.target}</java.target> + </additionalProperties> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>copy-resources</id> + <phase>validate</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}</outputDirectory> + <resources> + <resource> + <directory>src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/AppConfiguration.java b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/AppConfiguration.java index 97b153a..79ccb12 100755 --- a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/AppConfiguration.java +++ b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/AppConfiguration.java @@ -12,67 +12,37 @@ // *************************************************************************************************************************** package org.apache.juneau.petstore; -import java.util.Arrays; import org.apache.juneau.petstore.rest.*; import org.apache.juneau.petstore.service.*; import org.apache.juneau.rest.springboot.annotation.JuneauRestRoot; -import org.springframework.boot.web.servlet.*; import org.springframework.context.annotation.*; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.*; @SuppressWarnings("javadoc") @Configuration public class AppConfiguration { - //----------------------------------------------------------------------------------------------------------------- - // Services - //----------------------------------------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------------------------------------- + // Services + //----------------------------------------------------------------------------------------------------------------- - @Bean - public PetStoreService petStoreService() { - return new PetStoreService(); - } - - //----------------------------------------------------------------------------------------------------------------- - // REST - //----------------------------------------------------------------------------------------------------------------- - - @Bean - @JuneauRestRoot - public RootResources rootResources() { - return new RootResources(); - } + @Bean + public PetStoreService petStoreService() { + return new PetStoreService(); + } - @Bean - public PetStoreResource petStoreResource() { - return new PetStoreResource(); - } + //----------------------------------------------------------------------------------------------------------------- + // REST + //----------------------------------------------------------------------------------------------------------------- - /** - * 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; + @JuneauRestRoot + public RootResources rootResources2() { + return new RootResources(); } + @Bean - public CorsFilter corsFilter() { - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - CorsConfiguration config = new CorsConfiguration(); - config.setAllowCredentials(true); - config.addAllowedOrigin("*"); - config.setAllowedMethods(Arrays.asList("POST", "OPTIONS", "GET", "DELETE", "PUT")); - config.setAllowedHeaders(Arrays.asList("X-Requested-With", "Origin", "Content-Type", "Accept", "Authorization")); - source.registerCorsConfiguration("/**", config); - return new CorsFilter(source); - } + public PetStoreResource petStoreResource() { + return new PetStoreResource(); + } } diff --git a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/config/SpringSecurityConfig.java b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/config/SpringSecurityConfig.java deleted file mode 100755 index ebbc64c..0000000 --- a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/config/SpringSecurityConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.apache.juneau.petstore.config; - -import static org.springframework.http.HttpMethod.*; - -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - -/** - * Sets up BASIC authentication for our app. - */ -@Configuration -public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication() - .withUser("user").password("{noop}password").roles("USER") - .and() - .withUser("admin").password("{noop}password").roles("USER", "ADMIN"); - } - - @Override - protected void configure(HttpSecurity http) throws Exception { - http - .httpBasic() - .and() - .authorizeRequests() - .antMatchers(GET).permitAll() - .antMatchers(POST).permitAll() - //.anyRequest().authenticated() - //.antMatchers(GET).anonymous() // Allow anonymous read-only access. - //.antMatchers(POST).anonymous() // TEMPORARY. - .and() - .csrf().disable() - .formLogin().disable(); - } -} \ No newline at end of file diff --git a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java index dc938d7..642c6de 100755 --- a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java +++ b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/rest/PetStoreResource.java @@ -19,13 +19,11 @@ import static org.apache.juneau.http.response.Ok.*; import java.util.*; import java.util.Map; -import javax.inject.*; - import org.apache.juneau.jsonschema.annotation.*; import org.apache.juneau.petstore.*; import org.apache.juneau.petstore.dto.*; import org.apache.juneau.petstore.service.*; -import org.apache.juneau.*; +import org.apache.juneau.Value; import org.apache.juneau.annotation.*; import org.apache.juneau.html.annotation.*; import org.apache.juneau.http.annotation.*; @@ -36,6 +34,7 @@ import org.apache.juneau.rest.helper.*; import org.apache.juneau.http.response.*; import org.apache.juneau.rest.widget.*; import org.apache.juneau.transforms.*; +import org.springframework.beans.factory.annotation.*; import org.springframework.web.bind.annotation.CrossOrigin; import org.apache.juneau.rest.converters.*; @@ -129,7 +128,7 @@ import org.apache.juneau.rest.converters.*; ) public class PetStoreResource extends BasicRest implements PetStore { - @Inject + @Autowired private PetStoreService store; /** diff --git a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/rest/RootResources.java b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/rest/RootResources.java index a2b5127..a00c013 100755 --- a/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/rest/RootResources.java +++ b/juneau-petstore-server/src/main/java/org/apache/juneau/petstore/rest/RootResources.java @@ -30,18 +30,15 @@ import org.apache.juneau.rest.widget.*; description="Example of a router resource page.", children={ PetStoreResource.class - }, - debug="true" + } ) @HtmlDocConfig( widgets={ - ContentTypeMenuItem.class, - ThemeMenuItem.class + ContentTypeMenuItem.class }, navlinks={ "options: ?method=OPTIONS", "$W{ContentTypeMenuItem}", - "$W{ThemeMenuItem}", "source: $C{Source/gitHub}/org/apache/juneau/petstore/rest/$R{servletClassSimple}.java" }, aside={ @@ -55,12 +52,6 @@ import org.apache.juneau.rest.widget.*; "</div>" } ) -/*@SerializerConfig( - // For testing purposes, we want to use single quotes in all the serializers so it's easier to do simple - // String comparisons. - // You can apply any of the Serializer/Parser/BeanContext settings this way. - quoteChar="'" -) */ public class RootResources extends BasicRestServletGroup { private static final long serialVersionUID = 1L; } diff --git a/pom.xml b/pom.xml index 2ebe36d..d99e287 100755 --- a/pom.xml +++ b/pom.xml @@ -2,276 +2,271 @@ <!-- *************************************************************************************************************************** * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * + * distributed with this work for additional information regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations under the License. * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations under the License. * *************************************************************************************************************************** --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>org.apache.juneau.petstore</groupId> - <artifactId>juneau-petstore</artifactId> - <version>8.2.0-SNAPSHOT</version> - <packaging>pom</packaging> - <name>Apache Juneau Petstore Application</name> - <description>Sample application for demonstrating Apache Juneau.</description> - - <parent> - <groupId>org.apache</groupId> - <artifactId>apache</artifactId> - <version>21</version> - </parent> + <groupId>org.apache.juneau.petstore</groupId> + <artifactId>juneau-petstore</artifactId> + <version>8.2.0-SNAPSHOT</version> + <packaging>pom</packaging> + <name>Apache Juneau Petstore Application</name> + <description>Sample application for demonstrating Apache Juneau.</description> + + <parent> + <groupId>org.apache</groupId> + <artifactId>apache</artifactId> + <version>21</version> + </parent> - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <maven.compiler.source>1.8</maven.compiler.source> - <maven.compiler.target>1.8</maven.compiler.target> - - <junit.version>4.11</junit.version> - <servlet.version>3.1.0</servlet.version> - <httpclient.version>4.5.6</httpclient.version> - <juneau.version>8.2.0</juneau.version> - <derby.version>10.10.2.0</derby.version> - <hibernate.version>5.0.9.Final</hibernate.version> - <javax.inject.version>1</javax.inject.version> - <springframework.version>2.0.1.RELEASE</springframework.version> - <xml.apis.version>1.4.01</xml.apis.version> - </properties> - - <modules> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>18</maven.compiler.source> + <maven.compiler.target>18</maven.compiler.target> + + <httpclient.version>4.5.6</httpclient.version> + <juneau.version>8.2.0</juneau.version> + <derby.version>10.10.2.0</derby.version> + <hibernate.version>5.0.9.Final</hibernate.version> + </properties> + + <modules> <module>juneau-petstore-api</module> - <module>juneau-petstore-server</module> - <module>juneau-petstore-client</module> + <module>juneau-petstore-server</module> + <module>juneau-petstore-client</module> </modules> - - <build> - <plugins> - <plugin> - <artifactId>maven-enforcer-plugin</artifactId> - <executions> - <execution> - <id>enforce-maven</id> - <goals> - <goal>enforce</goal> - </goals> - <configuration> - <rules> - <requireMavenVersion> - <!-- ! Maven minimum 3.2.0 to build. --> - <version>3.2.0</version> - </requireMavenVersion> - </rules> - </configuration> - </execution> - </executions> - </plugin> - - <!-- - Runs Apache Rat against all source code to make sure all files have licenses. - --> - <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> - <!-- - ! Can be removed if updated to asf parent version 19. - --> - <configuration> - <excludes> - <exclude>**/DEPENDENCIES</exclude> - <exclude>**/target/**</exclude> - <exclude>**/empty.txt</exclude> - - - <!-- Eclipse metadata files --> - <exclude>**/.settings/**</exclude> - <exclude>**/.project</exclude> - <exclude>**/.classpath</exclude> - <exclude>**/*.launch</exclude> - <exclude>**/*.prefs</exclude> - - <!-- Overlay files --> - <exclude>**/*.2</exclude> - - <!-- Generated by embedded jetty server --> - <exclude>**/jetty.out.xml</exclude> - <exclude>**/derby.log</exclude> - - <!-- Generated in juneau-microservice-template for some reason --> - <exclude>**/dependency-reduced-pom.xml</exclude> - - <!-- Generated by juneau-docs.jar --> - <exclude>**/docs.txt</exclude> - <exclude>**/toc.txt</exclude> - - <!-- Files needed by Heroku as-is --> - <exclude>**/app.json</exclude> - <exclude>**/Procfile</exclude> - </excludes> - <consoleOutput>true</consoleOutput> - <!-- Note: useEclipseDefaultExcludes does not work for subprojects. See RAT-107 --> - </configuration> - <executions> - <execution> - <phase>verify</phase> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - - <pluginManagement> - <plugins> - <plugin> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <source>1.8</source> - <target>1.8</target> - <compilerArgument>-parameters</compilerArgument> - <testCompilerArgument>-parameters</testCompilerArgument> - </configuration> - </plugin> - - <plugin> - <groupId>org.eclipse.m2e</groupId> - <artifactId>lifecycle-mapping</artifactId> - <version>1.0.0</version> - <configuration> - <lifecycleMappingMetadata> - <pluginExecutions> - <pluginExecution> - <pluginExecutionFilter> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-remote-resources-plugin</artifactId> - <versionRange>[1.0,)</versionRange> - <goals> - <goal>process</goal> - </goals> - </pluginExecutionFilter> - <action> - <ignore> - </ignore> - </action> - </pluginExecution> - </pluginExecutions> - </lifecycleMappingMetadata> - </configuration> - </plugin> - </plugins> - </pluginManagement> - </build> - - <url>https://juneau.apache.org/</url> - <!-- Inherited from parent pom - <organization> - <name>The Apache Software Foundation</name> - <url>https://www.apache.org/</url> - </organization> - --> - <inceptionYear>2019</inceptionYear> - - <scm> - <connection>scm:git:https://gitbox.apache.org/repos/asf/juneau-petstore.git</connection> - <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/juneau-petstore.git</developerConnection> - <url>https://github.com/apache/juneau-petstore</url> - <tag>HEAD</tag> - </scm> - <issueManagement> - <system>Jira</system> - <url>https://issues.apache.org/jira/browse/JUNEAU</url> - </issueManagement> - <mailingLists> - <mailingList> - <name>Apache Juneau Developers</name> - <post>d...@juneau.apache.org</post> - <subscribe>list-subscr...@juneau.apache.org</subscribe> - <unsubscribe>list-unsubscr...@juneau.apache.org</unsubscribe> - <archive>https://lists.apache.org/list.html?d...@juneau.apache.org</archive> - </mailingList> - </mailingLists> - <developers> - <developer> - <id>johnadament</id> - <name>John D. Ament</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>sblackmon</id> - <name>Steve Blackmon</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>clr</id> - <name>Craig L Russell</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>stain</id> - <name>Stian Soiland-Reyes</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>jochen</id> - <name>Jochen Wiedmann</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>jamesbognar</id> - <name>James Bognar</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>dmg</id> - <name>David M Goddard</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>phaumer</id> - <name>Peter Haumer</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>yidonguk</id> - <name>Raphi D Lee</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>shalithasuranga</id> - <name>Shalitha Suranga</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>marcelosouzav</id> - <name>Marcelo Vieira</name> - <roles><role>PMC</role></roles> - </developer> - <developer> - <id>akayeshmantha</id> - <name>Ayeshmantha Perera</name> - <roles><role>PMC</role></roles> - </developer> - </developers> + + <build> + <plugins> + <plugin> + <artifactId>maven-enforcer-plugin</artifactId> + <executions> + <execution> + <id>enforce-maven</id> + <goals> + <goal>enforce</goal> + </goals> + <configuration> + <rules> + <requireMavenVersion> + <!-- ! Maven minimum 3.2.0 to build. --> + <version>3.2.0</version> + </requireMavenVersion> + </rules> + </configuration> + </execution> + </executions> + </plugin> + + <!-- + Runs Apache Rat against all source code to make sure all files have licenses. + --> + <plugin> + <groupId>org.apache.rat</groupId> + <artifactId>apache-rat-plugin</artifactId> + <!-- + ! Can be removed if updated to asf parent version 19. + --> + <configuration> + <excludes> + <exclude>**/DEPENDENCIES</exclude> + <exclude>**/target/**</exclude> + <exclude>**/empty.txt</exclude> + + + <!-- Eclipse metadata files --> + <exclude>**/.settings/**</exclude> + <exclude>**/.project</exclude> + <exclude>**/.classpath</exclude> + <exclude>**/*.launch</exclude> + <exclude>**/*.prefs</exclude> + + <!-- Overlay files --> + <exclude>**/*.2</exclude> + + <!-- Generated by embedded jetty server --> + <exclude>**/jetty.out.xml</exclude> + <exclude>**/derby.log</exclude> + + <!-- Generated in juneau-microservice-template for some reason --> + <exclude>**/dependency-reduced-pom.xml</exclude> + + <!-- Generated by juneau-docs.jar --> + <exclude>**/docs.txt</exclude> + <exclude>**/toc.txt</exclude> + + <!-- Files needed by Heroku as-is --> + <exclude>**/app.json</exclude> + <exclude>**/Procfile</exclude> + </excludes> + <consoleOutput>true</consoleOutput> + <!-- Note: useEclipseDefaultExcludes does not work for subprojects. See RAT-107 --> + </configuration> + <executions> + <execution> + <phase>verify</phase> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + + <pluginManagement> + <plugins> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <source>1.8</source> + <target>1.8</target> + <compilerArgument>-parameters</compilerArgument> + <testCompilerArgument>-parameters</testCompilerArgument> + </configuration> + </plugin> + + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-remote-resources-plugin</artifactId> + <versionRange>[1.0,)</versionRange> + <goals> + <goal>process</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore> + </ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> + </build> + + <url>https://juneau.apache.org/</url> + <!-- Inherited from parent pom + <organization> + <name>The Apache Software Foundation</name> + <url>https://www.apache.org/</url> + </organization> + --> + <inceptionYear>2019</inceptionYear> + + <scm> + <connection>scm:git:https://gitbox.apache.org/repos/asf/juneau-petstore.git</connection> + <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/juneau-petstore.git</developerConnection> + <url>https://github.com/apache/juneau-petstore</url> + <tag>HEAD</tag> + </scm> + <issueManagement> + <system>Jira</system> + <url>https://issues.apache.org/jira/browse/JUNEAU</url> + </issueManagement> + <mailingLists> + <mailingList> + <name>Apache Juneau Developers</name> + <post>d...@juneau.apache.org</post> + <subscribe>list-subscr...@juneau.apache.org</subscribe> + <unsubscribe>list-unsubscr...@juneau.apache.org</unsubscribe> + <archive>https://lists.apache.org/list.html?d...@juneau.apache.org</archive> + </mailingList> + </mailingLists> + <developers> + <developer> + <id>johnadament</id> + <name>John D. Ament</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>sblackmon</id> + <name>Steve Blackmon</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>clr</id> + <name>Craig L Russell</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>stain</id> + <name>Stian Soiland-Reyes</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>jochen</id> + <name>Jochen Wiedmann</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>jamesbognar</id> + <name>James Bognar</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>dmg</id> + <name>David M Goddard</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>phaumer</id> + <name>Peter Haumer</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>yidonguk</id> + <name>Raphi D Lee</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>shalithasuranga</id> + <name>Shalitha Suranga</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>marcelosouzav</id> + <name>Marcelo Vieira</name> + <roles><role>PMC</role></roles> + </developer> + <developer> + <id>akayeshmantha</id> + <name>Ayeshmantha Perera</name> + <roles><role>PMC</role></roles> + </developer> + </developers> - <distributionManagement> - <repository> - <id>apache.releases.https</id> - <name>Apache Release Distribution Repository</name> - <url>https://repository.apache.org/service/local/staging/deploy/maven2</url> - </repository> - <snapshotRepository> - <id>apache.snapshots.https</id> - <name>Apache Development Snapshot Repository</name> - <url>https://repository.apache.org/content/repositories/snapshots</url> - </snapshotRepository> - </distributionManagement> + <distributionManagement> + <repository> + <id>apache.releases.https</id> + <name>Apache Release Distribution Repository</name> + <url>https://repository.apache.org/service/local/staging/deploy/maven2</url> + </repository> + <snapshotRepository> + <id>apache.snapshots.https</id> + <name>Apache Development Snapshot Repository</name> + <url>https://repository.apache.org/content/repositories/snapshots</url> + </snapshotRepository> + </distributionManagement> </project>