r/springframework • • Jun 18 '19

The Spring Framework is for Nazis

Thumbnail
thewokeprogrammer.wordpress.com
0 Upvotes

r/springframework • • Jul 24 '22

First SpringBoot - How to see text in REST API

0 Upvotes

I created the first SprinBoot using the URL https://start.spring.io/ using SpringBoot 2.7.1, Gradle, Java 8, Jar, and added the dependency of Spring Web. The default download already created a jar file with one Java file. I can successfully launch the default app using gradlew bootrun.

The default app that was created by the default download is:

[code=java]

package my.tutorial;

import org.springframework.boot.SpringApplication;

// Added At (@) SpringBootAppication but not able to type it here

public class TutorialApplication {

public static void main(String\[\] args) {

	[SpringApplication.run](https://SpringApplication.run)(TutorialApplication.class, args);

}

}

[/code]

I coded a simple controller as:

[code=java]

package my. tutorial.controller;

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

Added At (@) RestController, but not able to type it here

public MyController {

Added At (@) /GetMapping("/hello")

public String hello() {

	return "hello";

}

}

[/code]

After coding the above, the application successfully starts with gradlew bootrun and it shows the default login page. The question from before still remains:

  1. How to change the default login page, as the default app seems to magically create this page?

  2. What else do I need to code/configure so that I can by typing un browser URL localhost:8080/hello the world hello will show up.


r/springframework • • Sep 02 '22

Spring Training in Chennai - Login360

Thumbnail
login360.in
1 Upvotes

r/springframework • • Aug 18 '22

Do I create a repository and spring beans/entity objects to handle database joins using Spring JPA/Hibernate?

1 Upvotes

The root of my obstacle is that I have two database tables, two entity objects and two repositories (that relate to this issue). I wrote a simple join query that joins a user id between the two tables and returns two fields in the result set (to be sent to the view). Since this custom query does not populate all of the fields of the two objects, Spring JPA throws an error on runtime. My assumption is that JPA expects to populate all of the fields of an entity object from the queries generated by CrudRepository.

Another assumption is that I may need to create a entity object that has two fields that match the names and data type of the two fields that I want to query using my select statement. But one that is not tied to a table, and then make a repository that links the other two repositories. Something akin to this:

interface UserRepository extends CrudRepository<User, Long>, HumanRepository, ContactRepository { // Declare query that joins the two repositories here and returns the custom entity object that has two fields }

Taken from this documentation source:

https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.custom-implementations

Are my assumptions correct here?


r/springframework • • Nov 17 '20

Episode 4 - Reactive Programming with Spring Boot

Thumbnail
youtu.be
1 Upvotes

r/springframework • • Sep 07 '19

UncategorizedMongoDbException not proper solution found on stackoverflow

1 Upvotes

Any idea how to solve this exception

org.springframework.data.mongodb.UncategorizedMongoDbException: Exception sending message; nested exception is com.mongodb.MongoSocketWriteException: Exception sending message
org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:138)
org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2781)
org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:2691)
org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:2434)...................

Caused by: com.mongodb.MongoSocketWriteException: Exception sending message
com.mongodb.internal.connection.InternalStreamConnection.translateWriteException(InternalStreamConnection.java:525)
com.mongodb.internal.connection.InternalStreamConnection.sendMessage(InternalStreamConnection.java:413)
com.mongodb.internal.connection.InternalStreamConnection.sendCommandMessage(InternalStreamConnection.java:269)
com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:253)
com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:99)
com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:444)
com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:72)
com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:200)
com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:269)
com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:131)
com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:123)
com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:242)
com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:233)
com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:136)
com.mongodb.operation.FindOperation$1.call(FindOperation.java:701)
com.mongodb.operation.FindOperation$1.call(FindOperation.java:695)
com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:462)
com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:406)
com.mongodb.operation.FindOperation.execute(FindOperation.java:695)
com.mongodb.operation.FindOperation.execute(FindOperation.java:83)
com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:179)
com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:132)
com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:86)
org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:2674)
... 32 common frames omitted

Caused by: javax.net.ssl.SSLException: Connection timed out (Write failed)
java.base/sun.security.ssl.Alert.createSSLException(Unknown Source)
java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
java.base/sun.security.ssl.TransportContext.fatal(Unknown Source)
java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(Unknown Source)
com.mongodb.internal.connection.SocketStream.write(SocketStream.java:79)
com.mongodb.internal.connection.InternalStreamConnection.sendMessage(InternalStreamConnection.java:410)
... 54 common frames omitted
Suppressed: java.net.SocketException: Broken pipe (Write failed)
java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
java.base/java.net.SocketOutputStream.socketWrite(Unknown Source)
java.base/java.net.SocketOutputStream.write(Unknown Source)
java.base/sun.security.ssl.SSLSocketOutputRecord.encodeAlert(Unknown Source)
... 60 common frames omitted

Caused by: java.net.SocketException: Connection timed out (Write failed)
java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
java.base/java.net.SocketOutputStream.socketWrite(Unknown Source)
java.base/java.net.SocketOutputStream.write(Unknown Source)
java.base/sun.security.ssl.SSLSocketOutputRecord.deliver(Unknown Source)
... 57 common frames omitted


r/springframework • • Apr 06 '22

Spring Boot and GRPC

1 Upvotes

Hello everyone,

I have a requirement to do a GRPC application but I have not found any Spring way of communication over GRPC. Either for server or clients.

How could I do GRPC in a spring boot service? AFAIK grpc is a Java library and it should be compatible with Spring boot


r/springframework • • Jun 17 '22

Security: How do you prevent a user from accesing other users resources?

2 Upvotes

How to prevent a user from accesing resources they do not own?


r/springframework • • Sep 20 '20

Check out Five Reasons to Use Spring Boot.

Thumbnail
youtu.be
2 Upvotes

r/springframework • • Jan 05 '21

does spring boot have job opportunities?

2 Upvotes

Im interested in pursuing backed development as a career in 2021.

is spring boot a good option?

thanks.


r/springframework • • Aug 15 '22

Keys saving in a spring boot application.

2 Upvotes

Hey guys, I have a key that I use to sign the JWTs. What’s the best practice to keep it in the system and correspondingly retrieve it when needed?


r/springframework • • Jan 20 '21

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

Thumbnail javavogue.com
3 Upvotes

r/springframework • • Jan 25 '21

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

Thumbnail javavogue.com
3 Upvotes

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 • • 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 • • Mar 27 '21

Spring boot works too slow with 1GB memory

4 Upvotes

I have searched on Google and found that a Spring Boot application with embedded tomcat server uses about 72M memory. However when I deploy a simple dockerized Spring Boot application to a server with 1 GB memory, it responds too slowly.

When I upgrade the server memory to 4 GB, the app responds very well. However, in a microservice architecture, cost of reserving 4GB servers for each microservice is very high. How can I optimize Spring Boot/JVM to use low memory.


r/springframework • • Mar 24 '21

SPRING DATA and SPRING NATIVE: Super fast startup times!

Thumbnail
youtu.be
4 Upvotes

r/springframework • • Sep 16 '21

Baeldung $400 Spring Security Master Class Review + Warning

Thumbnail self.learnjava
4 Upvotes

r/springframework • • Jan 05 '22

Making your RestTemplate fault tolerant with Resilience4J

Thumbnail
arnoldgalovics.com
4 Upvotes

r/springframework • • Mar 04 '22

Spring Constructor Injection: Why is it the recommended approach to Dependency Injection?

Thumbnail
youtu.be
10 Upvotes

r/springframework • • Mar 08 '22

Spring Mongo DB - one to many relationship

2 Upvotes

I have those two entities. The Tree has a list of at least one Leaf and a Leaf can't exists without a Tree.

@Document("tree") data class Tree( @Id val id: Long, val name: String,

@DocumentReference val leaves: List<Leaf>, )

@Document("leaf") data class Leaf( @Id val id: Long,

@DocumentReference val names: List<String>, )

I want at the moment when I'm saving a new Tree, also the list of the leaves to be saved too - as an ID - to the Leaf document.

How is possible to do something like that?

At the moment, when I'm saving a tree entity, only the tree document it's saved and there is not any relationship between tree and leaf.


r/springframework • • Feb 23 '22

Using Amazon Aurora Global Databases With Spring

Thumbnail
source.coveo.com
5 Upvotes

r/springframework • • Mar 01 '22

What are the most used Component library with Spring Mvc and Struts

4 Upvotes

I would like to develop an web application with Spring Mvc, hibernate and Mysql. I know there are many Component libraries that facilitate the development of web applications like Primeng for Angular, Telerik and Infragistics for Asp.Net MVC.

I'm looking for the components libraries that can be used with Spring MVC and Struts for Java web development.

What are the most used component libraries with Spring Mvc and Struts ?

Thanks for help


r/springframework • • Mar 04 '22

Need suggestions on this, initially posted on springboot.

Thumbnail self.springboot
1 Upvotes

r/springframework • • Feb 24 '22

Spring: NullPointerException trying to access findAll() @Repository

Thumbnail self.javahelp
2 Upvotes