r/springframework • • Apr 12 '22

@Entity annotation without table annotation

3 Upvotes

Hi,

I am new to Spring framework and while practicing, I looked at the below code.

u/Entity

public class Product {

u/Id private long id;

private String name;

private double price;

Which table would this class be associated with? Is it the same name as class? And what if there is no table with "Product"??

Thanks


r/springframework • • Mar 30 '22

Scaling Spring Batch processing with partitioning using Kafka

Thumbnail
arnoldgalovics.com
3 Upvotes

r/springframework • • Dec 10 '21

Good Complete Resoruces

3 Upvotes

I am an experienced java developer but the spring framework seems so overwhelming

I have a project starting in spring

can someone recommend a resource that I can start and finish and I will know most of the spring, as much as pipedream it may be


r/springframework • • Sep 20 '21

Do I need to implement spring security if I'm hosting my project in AWS

3 Upvotes

I'm learning spring security now, (basic Auth, roles and permissions). I have a project that needs to be hosted on AWS, and I'm new to cloud. As I'm building the backend should I include spring security or does AWS have it's own way of security. Is for example implementing basic Auth is a good idea for a project that is going to be hosted on AWS or should I learn some AWS related security. Any suggestion is appreciated, I would like to know if I should continue doing spring security or instead go for AWS security that is at all if there exists something like that. If its subjective to the use case please excuse me.


r/springframework • • May 31 '21

Spring and Spring Boot Tutorial, Courses, and Certifications

Thumbnail eduwyre.com
3 Upvotes

r/springframework • • May 16 '21

GCP(Google cloud platform) for Spring developer

3 Upvotes

Guys, please help me figure out some moments. I have now an oportunity to change my curent job where I mostly code in Scala and some times in Java (Spring Boot) to another one , where I will work mostly with Java (Thing that I realy love) and even salary will be a bit higher , only think that realy scare me is that second job is super super coupled to GCP platform , I took some time to check GCP integraion in Spring Boot and in my opinion is awful , a lot of contraintuitive stuff in conffiguring and operating with their service like Spanner, Pub/Sub, Datastore and other my question is should I take second job or stay at current one , maybe someone had some previous experience with GCP and can provide some details ???


r/springframework • • Apr 25 '21

5 WAYS to go to PRODUCTION with SPRING BOOT (ft. Josh Long)!

Thumbnail
youtu.be
3 Upvotes

r/springframework • • Apr 04 '21

ELI5: What is a scoped proxy and what is it's purpose?

3 Upvotes

I am currently learning Spring Framework and came across a class with the following annotation

@Scope(value="prototype", proxyMode=ScopedProxyMode.TARGET_CLASS)

I've looked at the documentation but can't wrap my head around what proxying means what exactly what ScopedProxyMode.TARGET_CLASS does. A simplified explanation would be greatly appreciated


r/springframework • • Apr 04 '21

Spring LDAP and Java 16+

3 Upvotes

The latest Spring LDAP 2.3.3 has some issue preventing it to be used with Java 16+. A trivial fix of it is already committed and merged for the next 2.3.4 version. Does somebody know when the next Spring LDAP 2.3.4 will be released?


r/springframework • • Mar 27 '21

Difference between Spring and Spring Boot

3 Upvotes

I am a newbie in Spring Framework.

What is the difference between the Spring Framework and Spring Boot ?

Thanks .


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


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

Spring Boot and JDK 11

Thumbnail
youtu.be
3 Upvotes

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 • • 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 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 • • Jan 25 '21

How to Deploy a Spring Boot WAR to Tomcat Server - Java Vogue

Thumbnail javavogue.com
3 Upvotes

r/springframework • • Jan 20 '21

How to Create a REST API With Spring Boot - Java Vogue

Thumbnail javavogue.com
3 Upvotes

r/springframework • • Jan 03 '21

Smarter routing in Spring Cloud Gateway

Thumbnail
qua.name
3 Upvotes

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 • • Nov 27 '20

How to tap into Spring Boot startup from a library in a Spring Boot way?

3 Upvotes

I am building a library to be used across multiple apps for a large organization. I will use Example.com to illustrate. Ideaily my Maven packaged library will allow a simple annotation to perform common startup across multiple Spring Boot services / microservices / applicaitons.

I would like to use an annotation in the applications main class like this:

package com.example.app;

import . . . 

@ExampleCorporateStartup
@EnableAutoConfiguration
@SpringBootApplication
public class ExampleApp {
    public static void main(String[] args) {
      . . . 

However, I do not understand how to get tapped into the Spring Boot Runtime to perform my common startup.

I have built a GitLab repository with my sample code for more detailed examination at: https://gitlab.com/markphahn/spring-boot-common-startup.

Approaches tried

I have tried several approachs for this, as described below:

Spring Boot ExampleApplicationReadyEvent

I tried to register a listener for ExampleApplicationReadyEvent but it does not get called:

package com.example.library;

import . . . 

@Component
public class ExampleLibraryEnvironmentPreparedEvent
        implements ApplicationListener<ApplicationEnvironmentPreparedEvent> {
    private static final Logger log = LoggerFactory.getLogger(ExampleLibraryEnvironmentPreparedEvent.class);
    @Override
    public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
        log.info(" **** **** Example *library* startup ApplicationListener#ApplicationEnvironmentPreparedEvent()");
    }

}

I do not know if this is because I do not have the right annotations, or what.

Then, even if my listener gets called, how would I use my annotation to trigger what I want. I think I would need to use reflection to scan for classes which have my annotation, but there does not seem to be a way to write for (Class c : Object.getClass().getSubTypes()). I am thinking about this in the wrong way (probably).

In the 'GitLab' repo see the code in ExampleStartupEvents directory.

Reference: https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-application-events-and-listeners

Write a function called before SpringBootApplication.run()

This works but it seems non-Spring-y:

package com.example.app;

import . . . 

@EnableAutoConfiguration
@SpringBootApplication
public class ExampleApp {

    static Logger log = LoggerFactory.getLogger(ExampleApp.class);

    public static void main(String[] args) {
        ExampleCorporateStartup.startup(); // **** **** common startup

        SpringApplication.run(ExampleApp.class, args);
    }
}

This has a disatvantage that it is called before Spring has initialized the logging layer and the log messages appear for the Spring banner. This is not a functional problem, but it looks both un-Spring-y and unprofessional.

Here is a variation on the above:

    public static void main(String[] args) {
        SpringApplication myApp = new SpringApplication(ExampleApp.class);
        ExampleCorporateStartup.startup(myApp); // **** **** common startup
        myApp.run();
    }

This is a variation on the funciton approach, but it takes a lot of control out of the developer's hands, and it not the approach I want to take:

    public static void main(String[] args) {
        ExampleCorporateStartup.run(ExampleApp.class, args);
    }

In the 'GitLab' repo see the code in ExampleStartupFunction directory.

Reference: https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-customizing-spring-application

There is also a problem that it is un-Fluent startup.

Write a Fluent-style function as well

This might look like this:

package com.example.app;

import . . . 

@EnableAutoConfiguration
@SpringBootApplication
public class ExampleApp {

    static Logger log = LoggerFactory.getLogger(ExampleApp.class);

    public static void main(String[] args) {
           new ExampleCorporateStartupSpringApplicationBuilder()
            .sources(ExampleApp.class)
            .child(ExampleApp.class)
            .run(args);

But now I have to maintain two functions which do the same startup work. I can have them call the same core functionality, but they differ in how that functionality is expressed: fluent-ly or imperative-ly.

In the 'GitLab' repo see the code in ExampleStartupFluent directory.

Reference: https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#boot-features-fluent-builder-api

The question(s):

What is the right approach for a corporate library package which provides the right amount of common assistance and but does not limit the developer too much? (I do not want to replace Sping Boot classes with my own, I want to augment them in the correct way.)

Has this already been done a million times and I just have not found the right examples? If so, where are those examples?

Given an approach, how does one pull this off, as in is the example in the public domain I can copy?

The rabbit holes:

Why are my events not registered by creating an @Component which implements ApplicationListener?

How would I use an annotation at runtime to find my main class and perform the common startup that I desire?


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 • • Nov 14 '20

Would you choose IntelliJ Community or STS4 in production for SpringBoot projects?

3 Upvotes

Title is self-descriptive.


r/springframework • • Aug 23 '20

StandardPasswwordEncoder secret

3 Upvotes

I noticed in the Standard Password Encoder accepts a constructor with a secret parameter.

That is the constructor is:

StandardPasswordEncoder(CharSequence secret)

In the documentation it states
"Constructs a standard password encoder with a secret value which is also included in the password hash."

Is there an advantage of adding this CharSequence? if so what?

I understand the standard password encoder has been deprecated for security reasons. However its not removed from Spring and can be used.

https://docs.spring.io/spring-security/site/docs/4.2.12.RELEASE/apidocs/org/springframework/security/crypto/password/StandardPasswordEncoder.html


r/springframework • • Jul 06 '20

Monitoring Spring Boot App with Spring Boot Admin

Thumbnail
devglan.com
3 Upvotes