Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spring Boot 3.0 support for SCIMple #104

Merged
merged 2 commits into from
Nov 30, 2022
Merged

Add Spring Boot 3.0 support for SCIMple #104

merged 2 commits into from
Nov 30, 2022

Conversation

bdemers
Copy link
Member

@bdemers bdemers commented Aug 15, 2022

No description provided.

@bdemers bdemers marked this pull request as draft August 15, 2022 16:50
@bdemers
Copy link
Member Author

bdemers commented Aug 15, 2022

NOTE: The Java 11 CI build does NOT build the Spring-Boot 3 bits.

Clone the project, use Java 17 (SDK MAN!), and build mvn install.

Run the project from your IDE or terminal: cd cd scim-server-examples/scim-server-spring-boot && mvn spring-boot:run

@bdemers bdemers changed the title Draft: Initial pass at SCIMple onSpring-Boot Draft: Initial pass at SCIMple on Spring-Boot Aug 15, 2022

```bash
# httpie
http :8080/Users
Copy link

@mraible mraible Aug 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should /Users be capitalized?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oddly enough, yes: https://www.rfc-editor.org/rfc/rfc7644#section-3.2

For some reason that capitalization seems really odd to me, but it's in the spec 🤷

@bdemers bdemers force-pushed the spring-boot branch 2 times, most recently from ea5473a to c2c635f Compare September 7, 2022 00:28
@bdemers bdemers force-pushed the spring-boot branch 4 times, most recently from a855464 to 79435a4 Compare September 8, 2022 23:49
@bdemers bdemers force-pushed the spring-boot branch 3 times, most recently from 31e20fa to 43fa2e3 Compare September 19, 2022 16:02
@mraible
Copy link

mraible commented Sep 29, 2022

When I check out this branch and run mvn install from the top-level, I get an error:

2022-09-29T13:14:34.401+01:00  WARN 81083 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inMemoryGroupService' defined in file [/Users/mraible/dev/directory-scimple/support/spring-boot/target/test-classes/org/apache/directory/scim/spring/it/app/InMemoryGroupService.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2022-09-29T13:14:34.401+01:00  INFO 81083 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-09-29T13:14:34.403+01:00  INFO 81083 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-09-29T13:14:34.405+01:00 ERROR 81083 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of constructor in org.apache.directory.scim.spring.it.app.InMemoryGroupService required a bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' that could not be found.


Action:

Consider defining a bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' in your configuration.

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.097 s <<< FAILURE! - in org.apache.directory.scim.compliance.tests.UsersIT
[ERROR] org.apache.directory.scim.compliance.tests.UsersIT  Time elapsed: 0.097 s  <<< ERROR!
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inMemoryGroupService' defined in file [/Users/mraible/dev/directory-scimple/support/spring-boot/target/test-classes/org/apache/directory/scim/spring/it/app/InMemoryGroupService.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:774)
	at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:227)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:931)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:926)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:592)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:751)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:442)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1323)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312)
	at org.apache.directory.scim.spring.it.app.SpringScimServer.start(SpringScimServer.java:34)
	at org.apache.directory.scim.compliance.junit.EmbeddedServerExtension.beforeAll(EmbeddedServerExtension.java:50)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:55)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:223)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:175)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:139)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)
	Suppressed: java.lang.NullPointerException: Cannot invoke "org.springframework.context.ConfigurableApplicationContext.stop()" because "this.context" is null
		at org.apache.directory.scim.spring.it.app.SpringScimServer.shutdown(SpringScimServer.java:43)
		at org.apache.directory.scim.compliance.junit.EmbeddedServerExtension.afterAll(EmbeddedServerExtension.java:72)
		at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeAfterAllCallbacks$18(ClassBasedTestDescriptor.java:461)
		at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
		at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeAfterAllCallbacks$19(ClassBasedTestDescriptor.java:461)
		at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
		at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeAfterAllCallbacks(ClassBasedTestDescriptor.java:461)
		at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.after(ClassBasedTestDescriptor.java:235)
		at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.after(ClassBasedTestDescriptor.java:84)
		at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:161)
		at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
		at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:161)
		... 35 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1782)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1341)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1295)
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:861)
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:765)
	... 63 more

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   GroupsIT » UnsatisfiedDependency Error creating bean with name 'inMemoryGroupService' defined in file [/Users/mraible/dev/directory-scimple/support/spring-boot/target/test-classes/org/apache/directory/scim/spring/it/app/InMemoryGroupService.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
[ERROR]   ResourceTypesIT » UnsatisfiedDependency Error creating bean with name 'inMemoryGroupService' defined in file [/Users/mraible/dev/directory-scimple/support/spring-boot/target/test-classes/org/apache/directory/scim/spring/it/app/InMemoryGroupService.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
[ERROR]   SchemasIT » UnsatisfiedDependency Error creating bean with name 'inMemoryGroupService' defined in file [/Users/mraible/dev/directory-scimple/support/spring-boot/target/test-classes/org/apache/directory/scim/spring/it/app/InMemoryGroupService.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
[ERROR]   ServiceProviderConfigIT » UnsatisfiedDependency Error creating bean with name 'inMemoryGroupService' defined in file [/Users/mraible/dev/directory-scimple/support/spring-boot/target/test-classes/org/apache/directory/scim/spring/it/app/InMemoryGroupService.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
[ERROR]   UsersIT » UnsatisfiedDependency Error creating bean with name 'inMemoryGroupService' defined in file [/Users/mraible/dev/directory-scimple/support/spring-boot/target/test-classes/org/apache/directory/scim/spring/it/app/InMemoryGroupService.class]: Unsatisfied dependency expressed through constructor parameter 0: No qualifying bean of type 'org.apache.directory.scim.core.schema.SchemaRegistry' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
[INFO]
[ERROR] Tests run: 5, Failures: 0, Errors: 5, Skipped: 0
[INFO]
[INFO]
[INFO] --- tools-maven-plugin:1.4:verify-legal-files (verify-legal-files) @ scim-spring-boot-starter ---
[INFO] Checking legal files in: scim-spring-boot-starter-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-failsafe-plugin:3.0.0-M7:verify (run-its) @ scim-spring-boot-starter ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for SCIM - Parent 1.0.0-SNAPSHOT:
[INFO]
[INFO] SCIM - Parent ...................................... SUCCESS [  0.631 s]
[INFO] SCIM - Specification ............................... SUCCESS [  0.041 s]
[INFO] SCIM - Specification - Schema ...................... SUCCESS [  5.015 s]
[INFO] SCIM - Specification - Protocol .................... SUCCESS [  1.333 s]
[INFO] SCIM - Client ...................................... SUCCESS [  0.298 s]
[INFO] SCIM - Core ........................................ SUCCESS [  2.534 s]
[INFO] SCIM - Compliance Tests ............................ SUCCESS [  0.228 s]
[INFO] SCIM - Server ...................................... SUCCESS [  7.537 s]
[INFO] SCIM - Server - Examples - Memory .................. SUCCESS [  0.445 s]
[INFO] SCIM - Server - Examples - Jersey .................. SUCCESS [  0.782 s]
[INFO] SCIM - Tools ....................................... SUCCESS [  0.901 s]
[INFO] SCIM - Total Test Coverage ......................... SUCCESS [  0.710 s]
[INFO] SCIM - Support - Spring Boot Starter ............... FAILURE [  3.776 s]
[INFO] SCIM - Server - Examples - Spring Boot ............. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  24.834 s
[INFO] Finished at: 2022-09-29T13:14:34+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M7:verify (run-its) on project scim-spring-boot-starter:
[ERROR]
[ERROR] Please refer to /Users/mraible/dev/directory-scimple/support/spring-boot/target/failsafe-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :scim-spring-boot-starter

My Java version:

$ java --version
openjdk 17.0.4.1 2022-08-12
OpenJDK Runtime Environment Temurin-17.0.4.1+1 (build 17.0.4.1+1)
OpenJDK 64-Bit Server VM Temurin-17.0.4.1+1 (build 17.0.4.1+1, mixed mode)

@bdemers
Copy link
Member Author

bdemers commented Sep 29, 2022

@mraible good catch!
Something had changed in the snapshot version of Spring Boot 3
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes#changes-to-auto-configuration

Luckily M5 was released last week, so we no longer need to worry about depending on a SNAPSHOT version of Spring (so this type of thing won't happen again)!

(This should be fixed in my last commit)

@bdemers bdemers changed the title Draft: Initial pass at SCIMple on Spring-Boot Add Spring Boot 3.0 support for SCIMple Nov 28, 2022
@bdemers bdemers marked this pull request as ready for review November 28, 2022 23:10
@bdemers
Copy link
Member Author

bdemers commented Nov 28, 2022

Updated build to require Java 17, but target 11

@bdemers bdemers merged commit 8b5a982 into develop Nov 30, 2022
@bdemers bdemers deleted the spring-boot branch November 30, 2022 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants