У нас вы можете посмотреть бесплатно How to get your Spring Boot project to work with JPMS или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Learn how to configure your `Spring Boot` application for the Java Platform Module System (JPMS) with clear, step-by-step instructions to solve common issues. --- This video is based on the question https://stackoverflow.com/q/74214182/ asked by the user 'Sandro J' ( https://stackoverflow.com/u/16163044/ ) and on the answer https://stackoverflow.com/a/74230572/ provided by the user 'Daniel Widdis' ( https://stackoverflow.com/u/1161484/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions. Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: How to get Spring boot project work with JPMS? Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/l... The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/... ) license. If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com. --- How to Get Your Spring Boot Project to Work with JPMS As developers continue to adopt modular programming practices in Java, one of the challenges they face is integrating existing frameworks, such as Spring Boot, with the Java Platform Module System (JPMS). If you’ve created a basic Spring Boot application and added a module-info.java file but encountered issues during runtime, you’re not alone. Understanding how to properly configure your application for modularity is key. In this post, we will dive into a common problem and provide a comprehensive solution to make your Spring Boot project work seamlessly with JPMS. The Problem You’re attempting to modularize your Spring Boot application by adding a module-info.java file, which declares your module and its dependencies. However, upon running your application, you encounter a series of exceptions in the console that indicate issues related to module access. For example, you may see errors such as: [[See Video to Reveal this Text or Code Snippet]] These errors arise because Java’s module system restricts access to classes and packages. Specifically, it does not allow access to classes in unnamed modules without the proper configuration. Understanding the Error What is the IllegalAccessError? The IllegalAccessError indicates that a class in your module is trying to access another class that it does not have visibility to. In the case of Spring, the issue relates to how the framework uses reflection internally for some of its functionalities, particularly in classes like org.springframework.cglib.core.ReflectUtils. Since this package does not have a module descriptor, it exists in the unnamed module which isn’t automatically visible to your module. Why do we need to adjust module permissions? In JPMS, if you want to use reflection, you need to explicitly open the packages or modules that your code is trying to access. This is part of how JPMS maintains strong encapsulation, preventing unintended access to classes. The Solution To resolve the issue at hand, you need to adjust the Java Virtual Machine (JVM) arguments in your project configuration. Here’s how: Step 1: Add the VM Argument You need to add a specific VM argument that tells Java to allow your module to read all classes in the unnamed module. You can do this in two ways: either through the command line or via your IDE's run configuration. Command Line If you’re running your application from the command line, include the following argument when you run your application: [[See Video to Reveal this Text or Code Snippet]] IDE Configuration If you are using an Integrated Development Environment (IDE) like IntelliJ IDEA or Eclipse, follow these steps: Open your run configurations. Look for the section where you can specify VM arguments. Add the following line: [[See Video to Reveal this Text or Code Snippet]] Step 2: Test Your Application After you have added the VM argument, run your application again. You should no longer face the IllegalAccessError and your Spring Boot application should start without issues. Conclusion Integrating Spring Boot with JPMS may present some challenges, especially when it comes to module access and reflection. However, with a better understanding of how JPMS works and the configuration steps provided above, you can successfully set up your Spring Boot project to work seamlessly within the modular environment. Remember to always check your module access configurations when running into issues and explore JPMS features to fully benefit from modular programming in your Java applications. By following these guidelines, you can harness the power of both Spring Boot and JPMS to build effective and scalable Java ap