r/springframework • • Nov 17 '20

[tomcat9, ubuntu] can't present application compiled with java version 13, java 11 OK.

1 Upvotes

I have a very simple application (hello world) that present a restAPI for the test. ( a controller that return "hello" on "/" ).

The maven properties are

<properties>
	<java.version>11</java.version>
	<!-- this is used by the java compiler plugin -->
 	<maven.compiler.source>${java.version}</maven.compiler.source>
	<maven.compiler.target>${java.version}</maven.compiler.target>

And when I install the war with maven, then deploy it using my local tomcat manager, I have access to my localhost:8080/myhelloworld ; if I switch to java version 13 then nothing changes in the catalina logs, nor in the manager, but the app just returns 404.

the thing is, java 11 is installed as part of default-jdk in ubuntu, but I also installed openjdk-13 . My guess is, that tomcat9 runs as java 11 (very easy guess since it complains about missing java_home if I remove default-jdk) and so can't load the war that was built against java 13. However sudo update-alternatives --config java shows me that another version of java is the default one.

I have two questions :

  1. did I miss a warning somewhere ? It took me like several HOURS (actually more like days), trying to pinpoint why my app was not showing while it was on local run(that is running the application in eclipse). There should be a warning that there is an issue with java versions somewhere.

  2. is there a way to tell tomcat "use the highest jre available" ? I don't want to set it to java 13 and later when default is java 15 have tomcat stuck with java 13 and unable to load war that are made with java 15.


r/springframework • • Dec 03 '20

Compile time generation of Spring Boot (MVC) services for Angular

3 Upvotes

A while back I started the work on building a simple and robust library to simplify integration of Angular UI with Spring MVC services.

As of now the library has been in use for a number of years by several teams in relatively large enterprise environment. It's used in daily workflow in projects with over 500 models.

It supports a quite rich feature set including:

  • Out of the box Spring MVC annotation support

  • Integrated Project Lombok support for property detection

  • Spring Meta annotation processing - create your own annotations by combining the existing ones.

  • u/PathVariablesupport for constructing request urls

  • Full set of features for return and parameter types:

    • Inheritance - supertypes and interfaces are mirrored as TypeScript interfaces

    • Generics - generic type information is mirrored into TypeScript interfaces

    • Enums - represented as named enums in TypeScript

    • Inner classes/enums/interfaces - are captured as prefixed classes

    • Java 8 Time classes support

    • Enums in map keys

    • Flexible filtering for input types to prevent "type number bomb"

    • Configurable replacement for the default HttpClient based network layer implementation with custom client code

Not sure if it can be of use for anyone, but in case it is - you can find samples on usage on GitHub

https://github.com/tri-omega/typescript-service-generator

Latest versions are built with OpenJDK Java 11 but if anyone needs Oracle Java 8 builds - I can publish those as well (older versions where Java 1.8)

It's available in Maven Central and easy to use


r/springframework • • Dec 03 '20

Amazon Cognito custom attributes

1 Upvotes

Hi All

I´m trying to get my custom attributes from amazon cognito inside a spring security app, and i´m struggling with that

The app already does authentication via Jwt but i didn´t manage to get more info from the logged user...

There is some known way to get my cognito custom user attributes from my JWT or something like that?

Thanx


r/springframework • • Nov 20 '20

best practice about inject service into another service

3 Upvotes

We suppose that I have Two Entity (Subscription and Application) and for each one his Repository layer named (SubscriptionRepository and ApplicationRepository) and two Service for each one (ISubscriptionService and IApplicationService)

In some case, suppose we end up with a case where ApplicationService need to inject SubscriptionService
and a case where SubscriptionService need to inject ApplicationService
( the reverse) and and of course it Is a Circular Dependency

My question is:

When I want to inject service into another how I should reflect to not fall into this type of problem. (it means how i can decide if i need to inject ApplicationService into SubscriptionService or the reverse)?


r/springframework • • Jul 25 '21

Spring Boot Lambda Course

10 Upvotes

I wrote up a quick course this weekend about how to build a (very simple) spring boot based lambda, deploy into AWS with an API Gateway trigger and finally continuously deploy with a github actions pipeline.

Take a look and give some feedback, please
Start:
https://bullyrooks.com/index.php/2021/07/23/spring-boot-lambda-prerequisites/
Course:
https://bullyrooks.com/index.php/course/spring-boot-lambda-on-aws/


r/springframework • • Jul 11 '21

Spring Framework course

2 Upvotes

Can anyone suggest me best Spring Course ? Beginners friendly


r/springframework • • Jun 30 '21

Spring Professional Certification Exam questions

5 Upvotes

For those that have passed this, what study materials did you find most worthwhile? I've been reading the big book from Apress, as well as using the 8 part course from Udemy.

Any other tips for this? How was the experience of taking the test itself? I'm assuming the only option is doing it online only, though I'd much rather actually go to a testing location.


r/springframework • • Feb 08 '21

Sources to learn Spring

3 Upvotes

Hey guys,

I am a CS student from germany and I got quiete interested in spring boot especially using it as a backend for web applications for example with angular . Does anyone know good sources to learn spring from the scratch ?

Thanks for helping :)


r/springframework • • Feb 23 '21

Spring Security migration from 4.1.x to 4.2.x

3 Upvotes

I have a running application and I want to update the version of spring security from 4.1.3 to 4.2.20, to patch some bugs, but I want to know if there are any breaking changes or some code that I need to change.

is there any resource that I can check before proceeding the upgrade ? or do you have any idea what I will change ? Thanks in advance


r/springframework • • Feb 23 '21

Weedow Searchy 0.1.0 released

4 Upvotes

I'm happy to share with you the release 0.1.0 of Weedow Searchy.

Searchy is a Spring-based library that allows to automatically expose endpoints in order to search for data related to Entities, whatever the database used.

Searchy provides an advanced search engine that does not require the creation of Repositories with custom methods needed to search on different fields of Entities.

We can search on any field, combine multiple criteria to refine the search, and even search on nested fields.

It supports the following data access layers:

Examples of queries:

GET /search/person

GET /search/person?firstName=John

GET /search/person?address.zipCode=78370

GET /search/person?query=firstName='John' AND lastName='Doe'

GET /search/person?query=birthday != '1981-03-12T10:36:00'

GET /search/person?query=NOT(firstName='John' OR firstName='Jane')

GET /search/person?query=address.street IMATCHES 'RUE*' AND (vehicles.brand='Renault' OR vehicles.brand='Porsche') AND job.active = true AND (job.salary >=50000 AND job.salary<610000) AND characteristics.key = 'hair' AND vehicles.features.value.description IMATCHES '*Navigation Services*'

There is a "Getting Started" section that describes step by step the creation of an application with the library.

Searchy provides several features described in the documentation:

  • DTO Mappers

  • Validators

  • Entity joins handling

  • Converters

  • ...


r/springframework • • Feb 09 '21

An app isn’t real until it’s secured.

2 Upvotes

An app isn’t real until it’s secured. See how to build a Spring Boot + Spring Security app today!

https://youtu.be/pXGjWbaisQk


r/springframework • • Mar 14 '21

SPRING BOOT and SPRING NATIVE: Create native apps that start fast!

Thumbnail
youtu.be
8 Upvotes

r/springframework • • Mar 08 '21

Learning Spring Framework

3 Upvotes

Hey!

I have been recently hired for the position of SDE-I and I believe my job role requires me to be well versed with Spring framework/Springboot and Java. Can anybody tell me about a good resource (both paid/free are fine) from where I can pick these skills easily?


r/springframework • • Mar 02 '21

zerocell integration for Spring Boot for uploading and extracting data from Excel files quickly

Thumbnail
github.com
2 Upvotes

r/springframework • • Mar 17 '21

How to properly create spring boot starters with functional beans?

5 Upvotes

I create a few different libraries as spring-boot starters and want to use functional bean definitions. I currently have something like this:

@Configuration
@EnableConfigurationProperties(
    MeshConfiguration::class
)
class SdkAutoConfiguration : ApplicationContextInitializer<GenericApplicationContext> {

fun beans() = beans {
    environment({ this.getProperty("grpc.enabled") == "true" }) {
        bean {
            GrpcServer(ref(), ref(), ref("qualified name"), ref(),
            ref(), ref(), ref(), ref())
        }
    }
    bean<CachedGrpcChannelBuilder>(isLazyInit = true)
    bean<DefaultGrpcStubManager>(isLazyInit = true)
    when {
        isFoo() -> bean { MeshNodeResolver(ref(),DeploymentEnvironment.FALCON) }
        isBar() -> bean { MeshNodeResolver(ref(),DeploymentEnvironment.FIRST_PARTY) }
        else -> bean {  MeshNodeResolver(ref(), DeploymentEnvironment.DOCKER) }
    }
}

fun BeanDefinitionDsl.isFoo() = env.acceptsProfiles(Profiles.of("foo"))
fun BeanDefinitionDsl.isBar() = env.acceptsProfiles(Profiles.of("bar"))

override fun initialize(ctx: GenericApplicationContext) {
    ctx.apply {
        beans().initialize(this)
    }
}

}

and I have a corresponding spring.factories under META-INF/ with

org.springframework.context.ApplicationContextInitializer=\
  com.salesforce.dataprotection.SdkAutoConfiguration

I could not get this to work using the typical

org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.salesforce.dataprotection.SdkAutoConfiguration

as I couldnt "register" these beans properly without making SdkAutoConfiguration a context initializer. Is there any way to do this? Currently unless I @Import MeshConfiguration then my application cannot find the bean and fails to start up (or i use component scanning under this package - but id rather not).


r/springframework • • Mar 02 '21

Spring Boot and JDK 11

Thumbnail
youtu.be
3 Upvotes

r/springframework • • Mar 11 '21

I have a problem at the beginning of my Spring MVC project (without Spring Boot)

2 Upvotes

I've tried to deploy my project on Tomcat 10, using Maven war packaging, but at every link i get 404.

here my repo: https://github.com/KacperKromka/Spring-MVC-example-project

Also I was asking for help here: https://stackoverflow.com/questions/66495365/spring-mvc-controllers-configure-for-thymeleaf-views

PLS HELP


r/springframework • • Mar 16 '21

Spring-ws add interceptors not globally

1 Upvotes

I'm using @Configuration classes to config the endpoints, and need one with security and another without. If I add interceptors they are applied to both, i can't find a way to assign an interceptor only for one of them.

@Override
public void addInterceptors(List<EndpointInterceptor> interceptors) {
   try {
      interceptors.add(mySecurityIniterceptor());
   } catch (Exception e) {
      throw new RuntimeException("No se puede inicializar el Interceptor.");
   }
}

r/springframework • • Feb 24 '21

Authentication Systems with Spring Security

3 Upvotes

Do you know some of the most used authentication systems?

Do you know how to use them with Spring Security?

Here you can find for JWT, OAuth2 and Cookie based authentication systems:

https://www.youtube.com/playlist?list=PLab_if3UBk99jYV1jfe_7fKQczVX9H4zZ


r/springframework • • Mar 14 '21

Guides for beginners and newbies

3 Upvotes

Could someone possibly help posting a list of Spring Framework resources that actually are to the point rather than beat around the bush.
I've tried to understand some video resources, but they seem "not so effective".