Code Monkey home page Code Monkey logo

devon4j's Introduction

devon4j

Devon4j is the Java stack of devonfw. It allows you to build business applications (backends) using Java technology in a highly efficient and standardized way based on established best-practices. To build web-clients as frontend for a devon4j backend we recommend devon4ng.

Apache License, Version 2.0 Maven Central Build Status

For details see modules below.

Options

Modules

Here you can see a list of all provided modules with their JavaDoc and Artifacts

  • basic basic JavaDoc basic artifact

  • batch batch JavaDoc batch artifact

  • batch-tool batch-tool JavaDoc batch-tool artifact

  • beanmapping beanmapping JavaDoc beanmapping artifact

  • beanmapping-dozer beanmapping-dozer JavaDoc beanmapping-dozer artifact

  • beanmapping-orika beanmapping-orika JavaDoc beanmapping-orika artifact

  • cxf-client cxf-client JavaDoc cxf-client artifact

  • cxf-client-rest cxf-client-rest JavaDoc cxf-client-rest artifact

  • cxf-client-ws cxf-client-ws JavaDoc cxf-client-ws artifact

  • cxf-server cxf-server JavaDoc cxf-server artifact

  • cxf-server-rest cxf-server-rest JavaDoc cxf-server-rest artifact

  • cxf-server-ws cxf-server-ws JavaDoc cxf-server-ws artifact

  • jpa-basic jpa-basic JavaDoc jpa-basic artifact

  • jpa-dao jpa-dao JavaDoc jpa-dao artifact

  • jpa-envers jpa-envers JavaDoc jpa-envers artifact

  • jpa-spring-data jpa-spring-data JavaDoc jpa-spring-data artifact

  • json json JavaDoc json artifact

  • kafka kafka JavaDoc kafka artifact

  • logging logging JavaDoc logging artifact

  • rest rest JavaDoc rest artifact

  • security security JavaDoc security artifact

  • security-jwt security-jwt JavaDoc security-jwt artifact

  • security-keystore security-keystore JavaDoc security-keystore artifact

  • service service JavaDoc service artifact

  • test test JavaDoc test artifact

  • test-jpa test-jpa JavaDoc test-jpa artifact

  • web web JavaDoc web artifact

devon4j's People

Contributors

abhaychandel avatar denise-khuu avatar devonfw-core avatar dixyushi avatar dolvie1012 avatar eduardkrieger avatar guentherjulian avatar hohwille avatar isandesh1986 avatar jambulud avatar joleuger avatar jorge-dacal avatar lillicao avatar lmarniazman avatar maihacke avatar markusschuh avatar maybeec avatar mustafaokyay avatar nelsonnew avatar rafaelvicariabarker avatar ravicm2 avatar rohit90700 avatar schettlerkoehler avatar sjimenez77 avatar ssarmokadam avatar sujith-mn avatar suprishi avatar suvmanda avatar tobka777 avatar vapadwal 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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  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

devon4j's Issues

Ability to log custom fields via SLF4J

As discussed in #36:
It would be awesome to find a way that via SLF4J we could log custom fields such as status-code or respons-time for the performance logging would end up as separate fields in the JSON. This would be very powerful for kibana dashboards, etc. At the moment we are producing CSV in the message was is not so great. I will file an issue for this but we will not be able to address this before the release.
Current result:

{"timestamp":"2018-11-06T18:36:37.638+00:00","@version":"1","message":"http://localhost:8081/services/rest/security/v1/currentuser;6678;200;;","logger_name":"com.devonfw.module.logging.common.impl.PerformanceLogFilter","thread_name":"http-nio-8081-exec-6","level":"INFO","level_value":20000,"appname":"basic"}

Expected result:

{"timestamp":"2018-11-06T18:36:37.638+00:00","@version":"1","message":"http://localhost:8081/services/rest/security/v1/currentuser","response-time":"6678","status-code":"200","logger_name":"com.devonfw.module.logging.common.impl.PerformanceLogFilter","thread_name":"http-nio-8081-exec-6","level":"INFO","level_value":20000,"appname":"basic"}

create visual distinction between wikis

@Jan-PeterRichterCG had a nice suggestion for improvement:

a simple and obvious distinction between the "wiki" and the "community wiki". Currently, you have to look at the URL in your browser's adress field to know where you are. What about a more "official" background color for the "wiki" or a watermark for the "community wiki"?

Rework namespace migration

In #1 I added several hits where oasp was still left from the original oasp4j project.
These things should be reworked with another PR.

devon4j api pom should use spring dependencies

As the new devon4j-api is used to contain api related files like interfaces, I was trying to generate with CobiGen those templates there, so that we are compliant with the new architecture.

One of the templates that I want to generate on the devon4j-api project is SearchCriteriaTo. This class extends from AbstractSearchCriteriaTo which imports org.springframework.data.domain.Pageable;.

The problem is that, by default, the pom of devon4j-api does not define the spring related dependencies like:

    <dependency>
      <groupId>com.devonfw.java.starters</groupId>
      <artifactId>devon4j-starter-spring-data-jpa</artifactId>
    </dependency>

Therefore we get compilation errors as Pageable is not found.

I would like to have that dependency on the pom by default.

Consider replacing hibernate-validatior with apache BVal

In #16 we are working on Java9+ (Java11) compatibility. The build is broken with Java11 for several reasons. One of them is that hibernate-validator depends on JavaFx. As JavaFx is no more included in Java11 it requires an external dependency. Even worse this dependency seems to be not available in maven central what broke our build. You can find the dependency here:
https://repo1.maven.org/maven2/org/hibernate/validator/hibernate-validator/6.0.14.Final/hibernate-validator-6.0.14.Final.pom

<profile>
  <id>jdk11+</id>
  <activation><jdk>[11,)</jdk></activation>
  <dependencies>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-base</artifactId>
      <version>${version.org.openjfx}</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</profile>

IMHO this is an odd dependency for a validation framework. It is fine if an optional dependency on JavaFx allows to support validation also for JavaFx beans and properties. However, enforcing this dependency to all devon project does not seem right to me.

My proposal is to switch to the alternative implementation BVal: https://bval.apache.org/

Automate devon4j Release Process with Jenkins

It should be relatively easy to write a Jenkins Job that does

  • Version Bumping (Remove -SNAPSHOT)
  • Tagging
  • Checkout tag
  • Build and deploy to maven central
  • Open next/increased -SNAPSHOT version
  • Push all changes including tags to remote
  • (optional and nice to have: if not triggered from develop branch, merge and push the changes to develop branch)

Parameters for the job would be:

  • branch (default = develop)
  • newVersion (default = X.Y.(Z+1)-SNAPSHOT)

BTW: To introduce some innovation: https://maven.apache.org/maven-ci-friendly.html
With this approach we do not even have to modify any POMs anymore for changing the version. This would make things more easy.

Cobigen-generated FindByCriteria behaves in unexpected way

When using Cobigen to generate the Entity infrastructure, it produces something like:

public interface AccountingEntryRepository extends DefaultRepository<AccountingEntryEntity> {

  /**
   * @param criteria the {@link AccountingEntrySearchCriteriaTo} with the criteria to search.
   * @param pageRequest {@link Pageable} implementation used to set page properties like page size
   * @return the {@link Page} of the {@link AccountingEntryEntity} objects that matched the search.
   */
  default Page<AccountingEntryEntity> findByCriteria(AccountingEntrySearchCriteriaTo criteria) {
...

The documented parameter pageRequest is apparently not part of the method's signature and is not mentioned in the generated code.
Instead, the generated AccountingEntrySearchCriteriaTo has a member private Pageable pageable from AbstractSearchCriteriaTO.

The documentation of that is:

  /**
   * @return the {@link Pageable} containing the optional pagination information or {@code null}.
   */
  public Pageable getPageable() {

    return this.pageable;
  }

However, if I call findByCriteria() with an AccountingEntrySearchCriteriaTo that has its Pageable not set, I receiver a Null Pointer Exception (this may be due to other problems in my code, not sure yet)

I have generated my project using devcon. I use the 3.0.0 distribution with the 20190115 patch.

create devon4j:3.0.0-alpha.1 release

To prepare for our final release we should already push out a release candidate/beta/alpha release. This would be very helpful for other dependent projects that could then already do or prepare the upgrade to win time and ease the critical path of our overall release.
Proposed steps:

  • merge PR #18
  • fix #15
  • create the release and deploy it to maven central
  • set version back to 3.0.0-SNAPSHOT

Remove deprecated code

Over the history of OASP4J serveral classes have been deprecated. Now, before devon4j hits the light, all classes that have been deprecated from OASP4J should be removed from devon4j before it becomes public. This is the chance now for the final cleanup!

How can i avoid reiteration of code mapping to eto from entity?

In the new versions of the structure of devon4j i have been having issues with code reiteration caused by not being able to create a save(Entity). Creating this method is not possible because the entities are generated in the core project and not in the api project. This fact forces me to transform to ETO to call a save method that will later transform to ENTITY with bean mapper. Example:

I want to decrease the queue customers by one when deleting an accesscode. This is located in UseCaseManageAccessCodeImpl.

	@Override
	public Boolean deleteAccessCode(long accessCodeId) {

		AccessCodeEntity accessCodeEntity = getAccessCodeRepository().find(accessCodeId);
		// Forced to map to ETO because I can't use entity in my QueueManagement
		QueueEto queueEto = getBeanMapper().map(accessCodeEntity.getQueue(),QueueEto.class);
		queueEto.setCustomers(queueEto.getCustomers() -1);
		getQueuemanagement().saveQueue(queueEto);

		LOG.debug("The queue with id '{}' has decreased its customers to: {}.", queueEto.getId(),
				queueEto.getCustomers());

		// we delete the accesscode
		getAccessCodeRepository().delete(accessCodeEntity);
		LOG.debug("The accesscode with id '{}' has been deleted.", accessCodeId);

		return true;
	}

This is the saveQueue(QueueEto queue) located in the UseCaseManageQueueImpl

	@Override
	public QueueEto saveQueue(QueueEto queue) {

		Objects.requireNonNull(queue, "queue");

		// Transformation from QueueEto to QueueEntity
		QueueEntity queueEntity = getBeanMapper().map(queue, QueueEntity.class);

		// initialize, validate queueEntity here if necessary
		QueueEntity resultEntity = getQueueRepository().save(queueEntity);
		LOG.debug("Queue with id '{}' has been created.", resultEntity.getId());
		return getBeanMapper().map(resultEntity, QueueEto.class);
	}

If i try to make a new method in the UseCaseManageQueue interface to later implement it:

	QueueEto saveQueue(QueueEntity queue);

the QueueEntity can not be found because the UseCaseManageQueue is in the api and the QueueEntity is in the core. This is feasible in the previous structure (Devon dist 2.4.0) because both the interface and the implementation were in the core. Using my-thai-star:

In the Dishmanagement:

...
  DishEto saveDish(DishEto dish);
  /**
   * Saves a dish and store it in the database.
   *
   * @param dish the {@link DishEntity} to create.
   * @return the new {@link DishEto} that has been saved with ID and version.
   */

  DishEntity saveDish(DishEntity dish) ;
....

In the DishmanagementImpl

....
  @Override
  public DishEntity saveDish(DishEntity dish) {

    Objects.requireNonNull(dish, "dish");
    // initialize, validate dishEntity here if necessary
    DishEntity resultEntity = getDishDao().save(dish);
    LOG.debug("Dish with id '{}' has been created.", resultEntity.getId());

    return resultEntity ;
  }
....

Doing it in this way, we are going to avoid two mappings. One to transform from ENTITY to ETO to use the save and then, inside the save from ETO to ENTITY. If there is a way to do this in the previous structure i would like to see if there is a way to do it in the new one.

Decouple from mmm-util-*

With OASP4J we have coupled with some things from mmm-util-* (esp. mmm-util-core). The main reason why mmm-util-core has been chosen was I18N. For that purpose it is still a valid recommendation if advanced I18N is required in Java Stack.
In the early days I also made use of existing interfaces that are also shipped with mmm-util-core. These also come with very detailed JavaDocs, etc. However, this way we coupled our entities with that and made them depend on mmm. So far still nothing is wrong and that code is all fine.
However, some customers seem to fight about every dependency and mmm is not a world-wide know project with common acceptance. Customers are arguing that there is too little community to guarantee maintenance of the code. Actually for APIs/interface we do not need maintenance and instead want to be things as stable as possible. So in the end all the arguments are entirely nuts. But just to get out of such discussions we should IMHO decouple our devon4j from mmm.
One argument that I as the maker of mmm can even see as a benefit is that mmm-util-core is shipped with some classes/interfaces that end up on the classpath and may "pollute" on code-completion. Examples are StringTokenizer (better than the one from java.util) or StringUtil (as apache commons, guava, etc. also come with such things).

For the record: I am also investing lots of energy (and hence spare time) to further modularize and improve mmm-util-* as you can see in m-m-m/util#250 (and I also already did m-m-m/util#169 to prepare for concerns from devon users).
In the end this is maintained better than many OSS projects with a bigger community. But who cares. With the decoupling I will also have freedom and not being trapped between the two projects.

REST Service not working - Pageable could not be constructed

Expected behavior

I'm trying to use the new devon4j 3.0.0 archetype with REST services generated by CobiGen. My front-end is an Angular application that tries to get all the employees from the database. The request is the following: /services/rest/employeemanagement/v1/employee/search.

I would like to get the correct data from the server without any kind of error.

Actual behavior

The response from the server is 500:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.springframework.data.domain.Pageable` (no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information
 at [Source: (org.apache.cxf.transport.http.AbstractHTTPDestination$1); line: 1, column: 13] (through reference chain: com.devonfw.poc.angular.employeemanagement.common.api.to.EmployeeSearchCriteriaTo["pageable"])

For creating the CobiGen templates, I have followed the starters example and generated a new SearchCriteriaTo on my common/api/to folder. That file contains a Pageable attribute that is not being properly constructed as the above error mentions.

Most probably the solution is to provide to the mapper a hint like explained here. Maybe there is an easy solution I don't see, but I think this is a crosscutting issue to be solved by the devon4j.

Batch template cannot be started

It seems, that the existing batch configuration served by the archetype is not working at all. First there is an exception as it tries to create a security bean although global method security is disabled.
Enabling it (why is it disabled?), you get an exception, that jobRegistry Bean is not provided.

I am using oasp 3.0.0, but I did not detect any difference in the latest template.

Also there seem to be EndpointAutoCofiguration excluded, but JmxAutoConfiguration not, which is not working either.

Just remembered, meanwhile I upgraded to latest SpringBoot Release. So maybe these issues are also as of this upgrade. Anyhow, maybe a good chance to check again.

Upgrade to spring-boot 2.1.x with hibernate 5.3 and JPA 2.2

Hibernate 5.3 is already out since a while and fully supports JPA 2.2:
https://www.thoughts-on-java.org/hibernate-5-3/
We should therefore use the official JPA 2.2 by replacing

      <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.1-api</artifactId>
        <version>1.0.0.Final</version>
      </dependency>

with

      <dependency>
        <groupId>javax.persistence</groupId>
        <artifactId>javax.persistence-api</artifactId>
        <version>2.2</version>
      </dependency>

To do so we also need to upgrade to hibernate 5.3 what will come with spring-boot 2.1.0:
spring-projects/spring-boot#11725
But currently not even the milestone 2.1.0.M1 is in maven central.

build does not work with java 10+

We have to update surefire so the build can work with new java versions. This applies both to the devon4j pom as well as to what we deliver with our archetype. IMHO we also need to update the compiler plugin.
As EOL is comming closer we should therefore get prepared.

See also junit-team/junit4#1513

build failure while building example project

Hi everyone,

i am new to devon and i am going through your trainings.
In the training video (http://de-mucevolve02/files/videos/devon_environment/Devcon.mp4) we are creating a simple server application with devcon.
When trying to build it (@17:50 in the video) with my freshly set up Devon-dist_3.0.0 i am getting a build failure:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project exam
pleServer-api: Compilation failure: Compilation failure:
[ERROR] /D:/Devon-dist_3.0.0/workspaces/exampleWS/exampleServer/api/src/main/java/com/capgemini/myServer/general/service/api/
rest/SecurityRestService.java:[9,45] package org.springframework.security.web.csrf does not exist
[ERROR] /D:/Devon-dist_3.0.0/workspaces/exampleWS/exampleServer/api/src/main/java/com/capgemini/myServer/general/service/api/
rest/SecurityRestService.java:[29,3] cannot find symbol
[ERROR] symbol: class CsrfToken
[ERROR] location: interface com.capgemini.myServer.general.service.api.rest.SecurityRestService

While running with debug i found following relevant lines:

[WARNING] The POM for com.devonfw.java.modules:devon4j-security:jar:3.0.0 is invalid, transitive dependencies (if any) will n
ot be available: 2 problems were encountered while building the effective model for com.devonfw.java.modules:devon4j-security
:3.0.0
[ERROR] 'dependencies.dependency.version' for org.glassfish.jaxb:jaxb-runtime:jar is missing. @
[ERROR] 'dependencies.dependency.version' for javax.activation:javax.activation-api:jar is missing. @

Can I fix this myself?

Thank you for your help & regards!
Vincent

Support 2-Factor Authentication

It would be great to have support for 2-factor auth in devonfw:

Just got in touch with Malte V. and Oliver H. - so if all goes right, Malte will do this as his bachelor thesis.

RevisionMetadata

RevisionMetadata (https://github.com/devonfw/devon4j/blob/c8f25cb073909db78d0329eda7ce44d93c9e9bae/modules/jpa-basic/src/main/java/com/devonfw/module/jpa/dataaccess/api/RevisionMetadata.java) is located in dataaccess layer.
However, this is the API that is also suitable to be exposed to logic layer and even via service APIs.
Therefore this interface and most probably its type implementation (https://github.com/devonfw/devon4j/blob/9b8f9461997bb5d8048a9fec42bec3625652eec3/modules/jpa-basic/src/main/java/com/devonfw/module/jpa/dataaccess/api/RevisionMetadataType.java) would need to be moved to common instead.

In order not to break compatibility, we would create a deprecated interface in the old place extending from the moved interface (and same for the type). The lazy implementation would still also implement the deprecated interface.
Then projects have the chance to migrate their code (what should also be supported by devcon migration).
In a later release we can then remove the deprecated code.

modules do not work with java 9+

With Java 9 and jigsaw the JDK was modularized and several modules are now not included anymore by default and might even go away as default modules. This applies to stuff like e.g. JAXB that was so far included into every JDK and therefore always available on the classpath.
Unless we really go to java9 modules we would IMHO need to add these as maven dependencies. With module-info.java descriptors we could even declare them via the java module system but so far we will stay at java 8 level.

Change order of PerformanceLogFilter and DiagnosticContextFilter

as stated in #36 the performance logging does not include the correlationId:

{"timestamp":"2018-11-06T18:36:37.638+00:00","@version":"1","message":"http://localhost:8081/services/rest/security/v1/currentuser;6678;200;;","logger_name":"com.devonfw.module.logging.common.impl.PerformanceLogFilter","thread_name":"http-nio-8081-exec-6","level":"INFO","level_value":20000,"appname":"basic"}

This is due to the fact that the DiagnosticContextFilter is in the wrong filter order compared to the PerformanceLogFilter and hence removes the correlationId from the MDC before the performance data is logged.

Acceptance criteria:
correlationId is included in the performance logging.

Error using JAVA 8 New Date/Time API.

We detect an error using the JAVA 8 Date/Time API and the actual DEVON implementation.

We have created an entity with LocalDate
image

After run the cobigen wizard this is the Interface obtained.
image

Then force us to implement method, that return a LocalDate object in the Eto that actually is not supported by the default implementation of dates by OpenApi and other standards.
image

Have a look to the OpenApi documentation https://swagger.io/specification/ section Data Types. More detail in https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14.

JAVA 8 Date / Time format mapper: https://dzone.com/articles/java-8-date-and-time

We can have a look into this? Is an already know way to work with this? Should this functionality been apply also in Cobigen?

Building devon4j wiki with Java 11

Building devon4j wiki with JDK 11 error leads to problems with maven-antrun-plugin. Mainly due dropped Nashorn support in JDK 11.

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (pre-process-asciidoc) on project devon4j-doc: An Ant BuildException has occured: The following error occurred while executing this line:
D:\workspace\cg\java_11\Devon-dist_3.0.0\workspaces\devon4j-wiki\devon4j.wiki\target\antrun\build-main.xml:15: Unable to create javax script engine for javascript
around Ant part ...... @ 5:30 in D:\workspace\cg\java_11\Devon-dist_3.0.0\workspaces\devon4j-wiki\devon4j.wiki\target\antrun\build-main.xml
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356

There is already an open issue for it below
https://issues.apache.org/jira/browse/MNG-6275

support for Java9+ (build and run)

I have tried the build with the new released jdk 11. This resulted in a new error, compared to the successful build with jdk10.

[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ devon4j-logging ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.devonfw.module.logging.common.impl.DiagnosticContextFilterTest
[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.409 s <<< FAILURE! - in com.devonfw.module.logging.common.impl.DiagnosticContextFilterTest
[ERROR] testInitWithNullInitParameter(com.devonfw.module.logging.common.impl.DiagnosticContextFilterTest)  Time elapsed: 0.332 s  <<< ERROR!
org.mockito.exceptions.base.MockitoException:

Mockito cannot mock this class: interface javax.servlet.FilterConfig.

Mockito can only mock non-private & non-final classes.
If you're not sure why you're getting this error, please report to the mailing list.


Java               : 11
JVM vendor name    : Oracle Corporation
JVM vendor version : 11+28
JVM name           : OpenJDK 64-Bit Server VM
JVM version        : 11+28
JVM info           : mixed mode
OS name            : Windows 7
OS version         : 6.1


Underlying exception : java.lang.UnsupportedOperationException: Cannot define class using reflection
Caused by: java.lang.UnsupportedOperationException: Cannot define class using reflection
Caused by: java.lang.IllegalStateException: Could not find sun.misc.Unsafe
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String, [B, int, int, java.lang.ClassLoader, java.security.ProtectionDomain)

[ERROR] testCorrelationIdHttpHeaderNameAfterConstructor(com.devonfw.module.logging.common.impl.DiagnosticContextFilterTest)
Time elapsed: 0.015 s  <<< ERROR!
org.mockito.exceptions.misusing.UnfinishedMockingSessionException:

Unfinished mocking session detected.
Previous MockitoSession was not concluded with 'finishMocking()'.
For examples of correct usage see javadoc for MockitoSession class.

Configure Logback for Core module

Background
This issue is related to issue devonfw/devon4j#38, for logging correlation ID in performance logs. Currently there seem to be no Logback configuration in place for Core module.

Current Behaviour
Correlation ID is not getting logged.

Expected Behaviour
Correlation ID should be logged when application is run as Spring Boot application from Core module.

ApplicationComponentTest interferes with DiagnosticContextFilter

Inheriting ApplicationComponentTest, which sets webEnvironment = NONE, tests fail as of the WebConfig shipped by the archetype creates a diagnosticContextFilter, which needs to get the WebApplicationContext injected. So every test fails as there is no WebApplicationContext.

A solution would be to remove webEnvironment from the SpringBooTest annotation of ApplicationComponentTest, which would leed SpringBoot mock the WebApplicationContext by default.

findPaginatedGeneric contains strange logic

Method findPaginatedGeneric(...) from here, contains strange logic when the Pageable parameter is not null.

image

Even though the method seems to handle null Pageable objects correctly in the if condition, it creates a new PageImpl instance which asserts that the pageable is not null. Therefore it throws a 500 internal server error.

From @Jan-PeterRichterCG comment:

  • the javadoc says: * @param pageable contains information about the requested page and sorting. There is no explicit documentation about a pageable that is null
  • later on in the code we find if (pageable != null) { ... which indicates that the code is intended to handle null-valued pageable parameters
  • However, if called with a null-valued pageable, it crashes due to PageImp<>() not accepting null

A clean solution would be to

  • decide whether findPaginatedGeneric() shall be able to process null-valued pageable parameters or not
  • if yes, there should be added an else branch to the afore mentioned if (pageable != null) { ... where the local pageable is set to the default Pageable - yielding the call to PafeImp<>() safe.
  • if no, it should be documented in the javadoc of findPaginatedGeneric() that the parameter pageable must not be null and the if (pageable != null) { ... can be deleted to make the code more staight-forward.

Slicing configuration in @SpringBootApplication class to area specific configuration files

Background:

  1. @SpringBootApplication configuration class is used by default as the configuration for tests. All the configurations present in this class are applied when a slice test is runs.

Problem:

  1. Causes errors as while running tests for a particular layer, beans for others layers are not available which are needed by the configuration. e.g when running tests for service layer using @WebMvcTest, because there is a configuration @EnableJpa* in the main class it looks JPA metadata model which is not present and hence error is thrown.
  2. Unnecessary classpath scanning if custom directive for additional package scan is added.
  3. @SpringBootApplication class is littered with all the configuration settings specific to particular area of functionalities.

Solution:

  1. Separate the area specific configurations to a separate configuration class at the same level as application. A particular configuration can be enabled in one of the tests with @import annotation.
  2. Move the custom directive to a separate configuration class.

For further reading: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html#boot-features-testing-spring-boot-applications-testing-user-configuration

Activate travis-ci

After migrating the code and working on #2 we want to have travis up and running for this repo.

Remove devon4j-configuration module

devon4j shipps with a module called configuration. However, this seems to be empty and hence pointless. Can we just remove this entirely?

create release 3.0.0

create the release:

  • bump version, tag, build, deploy to OSSRH, verify, close release
  • release/stage to maven central.
  • check for #42 and once done review and merge the community wiki
  • bump doc version deploy doc release to OSSRH and maven central

improve travis build stability

we are seeing strange errors in travis:

[INFO] [INFO] Downloading from apache-snapshots: https://repository.apache.org/snapshots/com/devonfw/java/modules/devon4j-beanmapping/3.0.0-SNAPSHOT/maven-metadata.xml
[INFO] [WARNING] Could not transfer metadata com.devonfw.java.modules:devon4j-beanmapping:3.0.0-SNAPSHOT/maven-metadata.xml from/to apache-snapshots (https://repository.apache.org/snapshots/): Connect to repository.apache.org:443 [repository.apache.org/207.244.88.140] failed: Connection timed out (Connection timed out)
[INFO] [WARNING] Failure to transfer com.devonfw.java.modules:devon4j-beanmapping:3.0.0-SNAPSHOT/maven-metadata.xml from https://repository.apache.org/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of apache-snapshots has elapsed or updates are forced. Original error: Could not transfer metadata com.devonfw.java.modules:devon4j-beanmapping:3.0.0-SNAPSHOT/maven-metadata.xml from/to apache-snapshots (https://repository.apache.org/snapshots/): Connect to repository.apache.org:443 [repository.apache.org/207.244.88.140] failed: Connection timed out (Connection timed out)
The thing is that we nowhere in my project configured this repository: https://repository.apache.org/snapshots

We need to find a solution or workaround to make travis do its job rather than failing for technical errors not related to our code.

use logstash-logback-encoder (JSON logging)

For logging eiPaaS is using ELK and today I learned that they have standardized the log-format and require apps to follow this. This technically means they use this standard OSS encoder for logback which produces JSON log lines instead of regular text patterns:
https://github.com/logstash/logstash-logback-encoder
@amarinso stated:

I would vote for having a single log file, json formatted and tools (or tips or techniques ) to split it if required or filter/prettyprint. We should be pushing for systems where log aggregators are the new normal. Let's make modern techniques, principles and patterns our default blueprint.

@maihacke stated:

I totally agree. Having a central log-collection is normal today and e.g. a security requirement in German public sector projects. So we should go with the JSON-Format per default.
I do so and have a special log-config for development where it is deactivated.

QueryDslSupport does not support Repositories to be declared in different maven modules

I am facing the following issue.
My setup is

<one of many apps>
 -> declaring code to access a security component
<shared lib "security">
 -> declaring the security component including the declaration of a JPA repository (spring data)
<shared lib "persistence">
 -> declares a datamodel shared by different applications including the UserEntity

For any reason the creation of the JpaRepository thinks, that there is a property 'newDslAlias' in the UserEntity class, but until now I could not find any reason for that. I would be happy for help.

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityUserRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query for method public abstract java.lang.Object io.oasp.module.jpa.dataaccess.api.data.QueryDslSupport.newDslAlias()! No property newDslAlias found for type UserEntity!
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1762)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1247)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1167)
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:593)
	... 45 common frames omitted
Caused by: java.lang.IllegalArgumentException: Failed to create query for method public abstract java.lang.Object io.oasp.module.jpa.dataaccess.api.data.QueryDslSupport.newDslAlias()! No property newDslAlias found for type UserEntity!
	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:82)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:103)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:208)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:79)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:566)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:559)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Iterator.forEachRemaining(Iterator.java:116)
	at java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Collections.java:1049)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:561)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:551)
	at java.util.Optional.map(Optional.java:215)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:551)
	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:324)
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297)
	at org.springframework.data.util.Lazy.getNullable(Lazy.java:211)
	at org.springframework.data.util.Lazy.get(Lazy.java:94)
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300)
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:119)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1821)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1758)
	... 55 common frames omitted
Caused by: org.springframework.data.mapping.PropertyReferenceException: No property newDslAlias found for type UserEntity!
	at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:94)
	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:382)
	at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:358)
	at org.springframework.data.mapping.PropertyPath.lambda$from$0(PropertyPath.java:311)
	at java.util.concurrent.ConcurrentMap.computeIfAbsent(ConcurrentMap.java:324)
	at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:293)
	at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:276)
	at org.springframework.data.repository.query.parser.Part.<init>(Part.java:81)
	at org.springframework.data.repository.query.parser.PartTree$OrPart.lambda$new$0(PartTree.java:250)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at org.springframework.data.repository.query.parser.PartTree$OrPart.<init>(PartTree.java:251)
	at org.springframework.data.repository.query.parser.PartTree$Predicate.lambda$new$0(PartTree.java:380)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
	at org.springframework.data.repository.query.parser.PartTree$Predicate.<init>(PartTree.java:381)
	at org.springframework.data.repository.query.parser.PartTree.<init>(PartTree.java:93)
	at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:76)
	... 81 common frames omitted

improve documentation on password encryption for strong encryption

I made use of jasypt password encryption in my property files.
One of my first step was to choose a strong cipher algorithm, so I was taking PBEWITHHMACSHA512ANDAES_256 as this was the best provided by jasypt at this moment of time. Interestingly, running the application, you get login issues as of non-provided password.
During debugging I found out, that the password is decrypted to empty string for some reason. I haven't found the cause yet.

Anyhow, googling further, it seems, that jasypt is very instable in regards to AES encryption:
https://sourceforge.net/p/jasypt/bugs/32/

Are there alternatives right now? Do we wait until jasypt is released in a proper version?

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.