Coder Social home page Coder Social logo

apress / pro-spring-6 Goto Github PK

View Code? Open in Web Editor NEW
67.0 5.0 50.0 1.31 MB

Source Code for 'Pro Spring 6' by Iuliana Cosmina, Rob Harrop, Chris Schaefer, and Clarence Ho

License: Other

Java 90.97% Groovy 0.17% Dockerfile 0.23% JavaScript 0.07% CSS 0.50% HTML 7.08% Kotlin 0.99%

pro-spring-6's Introduction

Apress Source Code

This repository accompanies Pro Spring 6 by Iuliana Cosmina, Rob Harrop, Chris Schaefer, Clarence Ho (Apress, 2023).

Cover image

Download the files as a zip using the green button, or clone the repository to your machine using Git.

Note
Please don’t skip reading this document before you get to work and the AsciiDoc files specific to each project. This project contains comments and references explaining implementation decisions that could make another book in itself. So, enjoy!

Releases

Release v6.0 corresponds to the code in the second edition of the published book, without corrections or updates. There have been small changes in the project configuration files to provide a more stable and a more up-to-date build.

This project was built successfully with JDK 19, Gradle 8.4 / Maven 3.9.5. The syntax is specific to Java versions up to and including 17.

Note
If you want to build it with JDK 17, modify the Maven/Gradle configuration files and edit all Java versions references.

Corrections

For corrections to the content in the published book, see the file Errata.adoc.

Contributions

See the file Contributing.adoc for more information on how you can contribute to this repository.

Building and Deploying

Note
This project requires Docker installed and running.
Note
Projects chapter07-jooq and chapter07-jooq-boot were updated to allow for a full build, which required some changes in the configuration of the Maven/Gradle files. However, they are still unpredictable, and sometimes they might fail because the container is not ready in time. I expect this to happen on slower computers. If this is an issue for you, just remove these projects from the general build, or just don’t run the full build at all.
Note
For easier Java versions management, if you are using a Linux/macOS I also recommend installing SDKMAN. And running the following command, to use the same JDK I used when writing this project:
> sdk install java 19.0.1-amzn

Using Gradle

The project is configured with the following default Gradle tasks:

defaultTasks 'clean', 'build'

This means that you do not have to specify those tasks when building the project from the terminal. Build it from scratch using the Gradle wrapper:

> ./gradlew

Or if you have Gradle installed locally, open a terminal and just run:

> gradle

If you want to skip the tests (build time will be shorter) run the wrapper with the following arguments:

> ./gradlew -x test

Or run Gradle with the following arguments

> gradle -x test
Important
Since I did not add the Gradle wrapper jar to the repository, download it by running gradle wrapper --gradle-version 8.4 .

Using Maven

The project is configured with the following default Maven goals:

 <defaultGoal>clean install</defaultGoal>

This means that you do not have to specify those goals when building the project from the terminal. Build it from scratch using the Maven wrapper:

> ./mvnw

Or if you have Maven installed locally, open a terminal and just run:

> mvn

If you want to skip the tests run the wrapper with the following arguments:

> ./mvnw -DskipTests

Or run Maven with the following arguments

> mvn -DskipTests
Important
Since I did not add the Maven wrapper jar to the repository, download it by running mvn -N wrapper:wrapper -Dmaven=3.9.5 .

pro-spring-6's People

Contributors

ahmed-hadaka avatar iuliana avatar markp88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pro-spring-6's Issues

Can't run chapter 5 ManualAdviceDemo

Compiling is ok, but when i run from chapter05 folder

java -cp .\target\classes\ com.apress.prospring6.five.manual.ManualAdviceDemo

i get

Error: Unable to initialize main class com.apress.prospring6.five.manual.ManualAdviceDemo
Caused by: java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice

What is wrong?

The specified Gradle distribution does not exist.

I started reading the book and just cloned the repo, but when using Gradle, I am getting the following error

The specified Gradle distribution 'https://services.gradle.org/distributions-snapshots/gradle-8.3-20230504222113+0000-bin.zip' does not exist.

What solved for me was changing the gradle in the wrapper config (here) from

distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-8.3-20230504222113+0000-bin.zip

to

distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip

Not sure if this is the best solution, but it worked for me :D

PS: I also needed to add a file gradle.properties to the root folder with something like this

org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m
org.gradle.parallel=true

to give Gradle more memory because I was getting java.lang.OutOfMemoryError: Java heap space

CustomPropertyEditorRegistrar does absolutely nothing

com.apress.prospring6.four.DiverseValuesContainer contains an inner static class named CustomPropertyEditorRegistrar. It is supposed to install the custom date and string editors. However it does absolutely nothing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.