Thorntail microprofile dependency - thorntail

looking at the Thorntail Project Generator I can see that it includes all the specific Microprofile extensions (health/load balancing/tracing...) and also includes this fraction:
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>microprofile</artifactId>
</dependency>
Is this dependency equivalent to including all single microprofile fractions in the project?
Thanks

Yes. The microprofile fraction is meant to bring in all fractions that are required for supporting the entire MicroProfile Platform.
Thorntail currently doesn't support any standalone MicroProfile specification (standalone specs are specs developed in the MicroProfile project, but are not part of the MicroProfile Platform; one example is MP Reactive Messaging). If there were fractions that implement these standalone specs, they would not be brought in by the microprofile fraction. But that's currently a theoretical question, as there are none.

Related

Is that possible to build a Quarkus native executable with a normal JavaEE and JAX-RS Project?

Let's say I've a project, which is about JavaEE and JAX-RS and normally deployed on wildfly. And now I need to implement Quarkus native.
So here is what I have:
A JavaEE project, which so far has no relation with Quarkus.
What I want to do:
1.Implement Quarkus native with a POM.
Is that possible ? Any Suggestions or Answers would be appealed.
Most JavaEE applications can be converted to Quarkus fairly easily as Quarkus has support for the most important JavaEE specs.
There are also various articles you can read up on. See this, this and this.
You can also check out the Migration Toolkit for Applications which provides insights on migrating existing applications to Quarkus.

Which dependency should be used to integrate Apache Camel with Spring Boot

Apache Camel provides two ways to integrate with Spring Boot:
camel-spring-boot
camel-spring-boot-starter
When I look at the starter then I see that it only includes camel-spring-boot and spring-boot-starter. What is the difference then and what are the advantages of using starter?
At the moment of writing this answer, camel-spring-boot is only supported from Camel 2.15 and camel-spring-boot-starter only from Camel 2.17, which is important considering the current version that your project is using.
Then the major difference between these two dependencies, lies in the "opinionated" auto-configuration provided by the starter.
camel-spring-boot, should be used if you want just to include a jar to make your camel routes auto-discovered by spring boot, this also gives you the freedom to update this dependency regardless of your spring-boot version.
camel-spring-boot-starter, (recommended way to go) should be used if you want a collection of dependencies (including camel-spring-boot) that provides the best developer/user experience, due to the fact of customizable properties, additional libraries, and default configuration for the camel library. Check the reference documentation for the starter: https://camel.apache.org/components/latest/spring-boot.html#_spring_boot_auto_configuration
Summary
Use camel-spring-boot, if you want a vanilla jar to use camel with spring boot
Use camel-spring-boot-starter, if you want an automatic-configured component to start to develop with.
You should always use the camel-xxx-starter dependencies, as these are the Camel components that is support with Spring Boot. Also as mentioned they provide auto configuration and some of them additional capabilities.
If there is no camel-xxx-starter component then its because its not supported on Spring Boot with Camel.
See more at: https://github.com/apache/camel/tree/master/platforms/spring-boot/components-starter#camel-component-starters

Successor for spring boot integrated java shell ('CRaSH') in Spring Boot 2.0?

As the spring documentation states the crasshd will be removed in spring boot 2.0.
What will be the replacement?
The previous shell you mentions was a port inside spring-boot 1 and it seems not very active.
In spring Boot 2.0 you can use the spring-shell that you can use in an existing spring-boot app or a specific spring-boot shell that can be deployed as standalone.
After, which option to take would depends on your needs.
On my side, I just created a specific shell for publishing messages in ActiveMQ, you get the whole power of Spring-Boot for automatic configuration of any connectivity with external systems (JMS, JDBC, LDAP, SMTP, etc...).
For doing this, I just added the following pom dependency:
<dependency>
<groupId>org.springframework.shell</groupId>
<artifactId>spring-shell-starter</artifactId>
<version>2.0.0.RELEASE</version>
</dependency>
in my Spring Boot project.
Note that I was able to integrate it in Spring Boot 1.5.15 and 2.1.2 RELEASES.
There is no replacement to be provided by the Spring team.
https://github.com/spring-projects/spring-boot/issues/7044
Sorry, not at the moment. Based on the stats we have, it would appear that the remote shell isn't very widely used. For example, comparing Maven Central downloads for August, the remote shell starter had 2% of the downloads that the web starter had. That means that it's unlikely to be worth investing significant effort in a replacement.
There is a third party replacement, from the ticket,
https://github.com/anand1st/sshd-shell-spring-boot

How can I know if a maven dependency is supported by a Java EE web container?

Background: I had a maven war project migrated from WildFly 10.1.0.Final Java EE7 Full & Web Distribution to Payara Server 164 Full. The pom.xml was set to specifically satisfy WildFly environment. As a result, some of the <provided> scoped dependencies became problematic after migration because Payara did not have correct implementations for them. By changing some of the dependency scopes to <compile>, I fixed the problems. But it seemed not very smart to try out each of the dependencies to see if one was provided by the container or not.
Question: How can I know what dependencies are supported by a particular container?
For example, there are many versions of Servlet API. How can I know if version 4.0.0-b01 is supported by GlassFish 3.1.2.2?
I want to be able to do it in an appropriate way. E.g. reading from the documentations, using an official toolkit, etc. By the way, I searched in Payara's documentation. But I didn't find a list of supported dependencies and versions.
Alright, I eventually found out a nicer way to do this. I was inspired by this answer, although, it was not directly related to my question.
Short answer:
Go to Java EE version history on Wikipedia. There is a full list of implementations of all the APIs that each Java EE container version implements.
Full answer:
Java EE containers are implementations of Java EE APIs. It means that Java EE projects do not need to contain all the implementation libraries of the dependencies being used. Instead, they need only API libraries such as servlet-api : 3.1.0. However, if any of the API version is "too new" or "too old", and the non-implemented abstract methods are called, an AbstractMethodError will be thrown.
Here is an example of reproducing this error:
On a Java EE 7 container (GlassFish 4) with jdk 1.8, use servlet-api : 4.0.0-b02 as your Servlet API (which contains abstract methods with default implementations). Create a ServletFilter without implementing init and destroy methods. Deploy and start the server. an AbstractMethodError will appear during startup.
The reason for this is that servlet-api : 4.0.0-b02 is supposed to be implemented in Java EE 8. Java EE 7 is associated with jdk 1.7 which does not support default interface method. With servlet-api : 3.1.0 (which is implemented by Java EE 7), init and destroy methods must be implemented in the project. Whereas, when using servlet-api : 4.0.0-b02, it is possible to not implement them. That is where problems occur.
In conclusion, it is generally not a good idea to use different versions between Java EE APIs and their implementations. Oracle provides specifications for different versions of Java EE APIs as an official introduction. It should be checked when building project dependencies.
To use them directly is not a very smart idea.
If you need web profile, just use:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
If you need full profile, slightly change it to:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
And you're done. Everything present in the project from now on that comes from this set of dependencies is present in the application servers.
This is actually the correct way to do it. Your way is wrong and whoever told you to work with Java EE like this deserves punishment.

Integrating Guice and OSGi services

What's the current situation with integrating Guice and OSGi? I.e. exposing OSGi services from Guice, injecting them, etc.
Peaberry's main page mentions "The Guice trunk (which will become 2.0)", but 1.2 seems up-to-date, since it fixes http://code.google.com/p/peaberry/issues/detail?id=58. Its author has switched Sisu, but it doesn't seem to be released yet. Any others?
The integration of Guice 3.0 and Peaberry 1.2 currently is working like expected. Just the page seems to be a little outdated sind the snippet mentioned above refers to the Guice 2.0 trunk which has been superseded.
The Bug your referencing is fixed for the 1.2 Peaberry release when you look at the repository history here.
It's true that Sisu is currently developed and it solves (at least how I interpret it) some additional problems that are currently existing with Guice + Peaberry + OSGi (e.g. automatic component scanning and discovery) but it isn't ready yet.
In my opinion Peaberry solves the same integration cases of DI and OSGi that are also solved by Spring Dynamic Modules (now Eclipse Gemini Blueprint) and is therefore very useful. Also I don't think necessarily that the Peaberry project will be abandoned in favor of sisu.
If all you stay true to the OSGi idea of developing independent bundles that are wired through services but you want to use DI inside them, Peaberry currently offers everything you need for that.
The only problem I'm currently facing with that combination is that the official guice-servlet module doesn't seem to play with the OSGi HttpService by default.

Resources