Questions tagged [spring-boot]

12994 questions
0

votes
1

answer
8

Views

Getting kubernetes secret / env for authentication into java application

I hava a java spring.boot application that uses Kubernetes, I'we configured this .yaml file - name: ACTUATOR_USERNAME valueFrom: secretKeyRef: name: actuator key: username - name: ACTUATOR_PASSWORD valueFrom: secretKeyRef: name: actuator key: password added this attributes to my application.properti...
JonB
0

votes
0

answer
24

Views

Spring RestTemplate make a multipart request

I've two microservices(built in spring-boot). Let's consider microservice A & microservice B. I want to make a proxy call of multipart form request. For that I'm using RestTemplate. But I'm getting the error org.springframework.web.client.HttpClientErrorException: 406 null. It's working properly if...
AshwinK
0

votes
0

answer
6

Views

JPA Eclipselink query parse problem in windows 7

I have a standalone spring boot web service which uses eclipselink v2.7.3. I have query in NamedQuery inside my class. SELECT m , o.iduserinsert.id as iduserinsert FROM Mytable m, Order1 o WHERE o.idmytable=m and (o.id is null or o.idorderstatus.id in (1,3,4)) and m.iddepartment = :iddepartment...
rgaraisayev
1

votes
2

answer
2.5k

Views

spring boot not launching static web content

Am trying to launch index.html in my spring boot app but see 404. What dependency am I missing? build.gradle (multi project) project('sub-project') { apply plugin: 'spring-boot' compile ( "org.springframework.boot:spring-boot-starter-web:1.0.0.RC5", "org.springframework.boot:spring-boot-starter-actu...
suman j
1

votes
0

answer
68

Views

Spring Boot Application With Axis2 - /BOOT-INF/lib/addressing-1.6.2.mar file cannot be found

During SOAP call am getting a below exception, but in local am not getting any exceptions. I am really not sure why addressing-1.6.2.mar referring application jar path. Axis2 Structure: VM Arguments: JAVA_HOME=/apps/jdk/jdk1.8.0_111 ANTIFRAUD_HOME=/apps/Benefits/AntiFraud/r20/dev nohup $JAVA_HOME/bi...
Bharathiraja S
0

votes
0

answer
6

Views

Get method mapped to request in Spring Security

I have to use some custom role authorization logic with spring security and jaxrs. Meaning I want to use my custom annotation. I have a problem with obtaining the method and class that are mapped to the current request and I need them so I can extract the annotations present on them. I tried injecti...
randomname
1

votes
0

answer
10

Views

Sending Multipart/mixed request with boundaries

I am trying to create a multipart-mixed request with two sections:- application/x-url-form-encoded multipart/form-data Example Request:- POST http://sample:8080/api/documents HTTP/1.1 Accept: application/json Accept-Language: en API-Version: 2 Content-Type: multipart/mixed; boundary=19D523FB Host:...
leo_roar_001
1

votes
1

answer
5k

Views

Connecting to both spring-batch and application database using spring-boot

Spring batch had it's own database schema. My application has it's own database schema. I want to keep these separated into different databases so the spring-batch tables are not inside my applications database. By default spring-boot only supports connection to a single database. How do I config...
jax
1

votes
5

answer
5.4k

Views

log4j2.xml loaded but not applied [JVM argument]

I am trying to create a batch using spring batch, spring mvc and spring boot. And I am using log4j2 for logging. My goal is to load an external log4j2.xml configuration file thanks to JVM arguments like that -Dlog4j.configurationFile=file://C:\{path}\Workspace\demo-indexeur\config\log4j2.xml Spring...
youtix
1

votes
3

answer
6.2k

Views

Example for Spring Cloud Consul with Ribbon for client side load balancing

I see that spring-cloud-consul is live in spring.io [https://spring.io/blog/2015/05/27/spring-cloud-consul-1-0-0-m1-available-now] but I hardly see any reference examples. I am mainly looking for Service Registration and Service Discovery with Consul and Ribbon as client side load balancer. Could so...
PPK
1

votes
1

answer
3.5k

Views

spring-boot-starter-web vs spring-boot-starter-thymeleaf

I try understand how spring boot is working with html pages. I started following the guide from spring.io. This guide is showing how to work with html page and view technology Thymeleaf. It has page: Getting Started: Serving Web Content I have changed it to simple Getting Started: Serving Web Conte...
Loniks
1

votes
1

answer
8.5k

Views

findBy with custom filter in PagingAndSortingRepository

I have an interface extending the PagingAndSortingRepository I have a custom find like : findJobByNameBySystemIdUserCompanyId(companyId, pageable) This works fine, now I want to introduce filtering, so I want to search (like) for string in the list. How can I achieve that? The search term could be...
victor
0

votes
1

answer
19

Views

Criteria make mongo query

I try to make some query to find users that have birthday. That query is: db.getCollection('_user').find({ "$and" : [ {"$expr" : [{ "$dayOfMonth": "$time_created" } , { "$dayOfMonth": new Date() }]}, {"$expr" : [ { "$month": "$time_created" } , { "$month": new Date() }]}, {"$expr" : { "$ne" : [ {...
devss
1

votes
1

answer
1.1k

Views

Update version of org.springframework.boot to 1.3.2

I use org.springframework.boot version 1.2.5.Release and application runs without errors. Now I want change version of org.springframework.boot to 1.3.2. My pom file is ... org.springframework.boot spring-boot-starter-parent 1.2.5.RELEASE UTF-8 1.8 springio org.springframework.boot spring-boo...
Anar Amrastanov
1

votes
2

answer
1.4k

Views

logoutSuccessUrl not working in Spring Boot

I have a simple Gradle Spring Boot (v 1.3.3) WebMVC application I'm running from the command line via "Gradle bootrun". I am also including Spring Security and am overriding some default security configuration by including a java security config class. My build file is buildscript { ext { springBoot...
Mike HT
1

votes
1

answer
891

Views

Unable to authenticate mongodb from springboot application

I am using a spring boot application to connect MongoDB instance. We have enabled authentication on MongoDB with following roles roles: [ { role: "dbOwner", db: "{{ mongo.database_name }}" } roles: [ { role: "readWrite", db: "{{ mongo.database_name }}" } We are providing the credential using conf f...
Deepak Chaudhry
1

votes
1

answer
733

Views

Accessing Spring Boot resource as File in Controller

I need to access the files I have in /src/main/resources/static/myfolder in my Spring Boot Controller using the java.io.File API. I tried File folder = new File("/myfolder/"); But it doesn't work. Any ideas?
CraigFoote
0

votes
0

answer
4

Views

JPSQ custom query with mapping to new Object

How can I convert this SQL expression to JPSQ custom @Query and map to new Object in Java Spring Boot via JPARepository SELECT DOCUMENT_TYPE.TITLE, SUM(case when DOCUMENT.DOCUMENT_STATE = 1 then 1 else 0 end) as CREATED, SUM(case when DOCUMENT.DOCUMENT_STATE = 0 then 1 else 0 end) as SUBMITTED FR...
0

votes
0

answer
4

Views

JPA Join on multiple columns in OR condition

I have 3 entities and I want to make the following SQL query with a JPA CriteriaBuilder. SELECT * FROM record as a JOIN record_management as b ON (a.id_supervisor = b.id OR a.id_manager = b.id) JOIN user as c ON(b.id_user = c.id) WHERE a.id_company = 1 I try writing the following code but I cannot w...
samjackit
1

votes
2

answer
3.3k

Views

java.lang.IllegalStateException: No instances available for ip

Below is my bom microservice: @RestController @Configuration @ComponentScan @SpringBootApplication @EnableEurekaClient @EnableDiscoveryClient @EnableAutoConfiguration public class PLMBommsApplication { private static final Logger LOG = LoggerFactory.getLogger(PLMBommsApplication.class); @Bean @LoadB...
Santosh
1

votes
2

answer
560

Views

How to remove extra field 'decoratedClass' in JSON response for Spring Data projections?

Hello I'm using Spring Data Projection to simplify original object 'Announcement'. I created interface with get-methods for field I need: public interface SimplifiedAnnouncement{ String getTitle(); Integer getPrice(); String getPlace(); } Then I just use it in Repository: public interface Announceme...
Kerins_Sataier
1

votes
1

answer
1.4k

Views

What's wrong with my JPQL query?

I am trying to implement join but I am facing error. I have product table and store table. product table references store table through foreign key as shown below: Product.java @Entity public class Product { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long pId; private String model;...
Breaking Benjamin
0

votes
0

answer
3

Views

Is there a way to configure ClientDetailsServiceConfigurer accessTokenValiditySeconds after service startup?

I want to be able to configure the time to live of the access token from client side, not only at server startup with Oauth2. For now, I am able only to set the expiration time at server startup, see my code below. @Configuration @EnableAuthorizationServer @EnableGlobalMethodSecurity(securedEnabled...
anfilip
1

votes
1

answer
6.2k

Views

Spring Boot with spring-boot-starter-web fails to compile in maven

I am using jdk1.7 and spring boot 1.4.2.Release.I created a brand new Spring boot project from start.spring.io. It compiled fine. I tried to add the below dependency for exposing a REST web service. org.springframework.boot spring-boot-starter-web I get the below error: [ERROR] Failed to execute goa...
Swati Gupta
1

votes
1

answer
17

Views

Were GlobalSession scoped beans removed from spring 5? Why?

1. Were global-session scoped beans removed from Spring 5? Official documentation no longer mentions it. SCOPE_GLOBAL_SESSION is no longer part of RequestAttributes: Spring 4: https://docs.spring.io/autorepo/docs/spring/4.2.4.RELEASE/javadoc-api/org/springframework/web/context/request/RequestAttribu...
Witold Kaczurba
0

votes
0

answer
4

Views

Dynamically Secure Method Using Spring Security - Role Based Access Control

@CrossOrigin(origins = "*", maxAge = 3600) @RestController public class RbacAccess { @GetMapping("/api/user") @PreAuthorize("hasRole('ROLE_USER')") public String userAccess() { return ">>> User Contents!"; } @GetMapping("/api/admin") @PreAuthorize("hasRole('ROLE_ADMIN')") public String adminAccess()...
Md.Samiul Arafin
0

votes
0

answer
7

Views

Remove Garbage characters from Request Body in Spring Boot?

I am making a server for a Chinese device whose firmware I cannot change by any means. It sends JSON data in request body to my server with headers-> content-type : [application/octet-stream]. Now getting the body in Spring boot has some garbage characters in the start and end of body. Body: � {...
Purujit Bansal
0

votes
0

answer
7

Views

can we create stand alone application for Spring boot web mvc using Electron tool?

I am trying to create a stand-alone application for spring boot. I have a code of spring boot mvc and I am trying to build a desktop application using Electron tool.
arpit_writes
1

votes
0

answer
16

Views

I want to save credential( OAuth2.0) in the project. not on disk. - google sheet api

I added google-api for spread sheet. But now, I want to save credential on my project, not on the server. This is part of code. private static final java.io.File DATA_STORE_DIR = new java.io.File(System.getProperty("user.home"), ".credentials/sheets.googleapis.com-java-quickstart"); The code saves c...
NamKyung Lee
1

votes
1

answer
856

Views

Microservices Config and eureka service which one to start first?

I am creating a simple project in microservices using spring boot and netflix OSS to get my hands dirty. I have created two services config service which has to register itself in discovery(eureka) service. discovery service which requires config service to be running to get its configuration. Now...
maverick
1

votes
1

answer
15

Views

MySQL DataSource in Spring Boot is not available in other Service/Control classes and throwing null pointer exception

I am not an expert with Java and Springboot but I am building a QuartzScheduler application with JDBCStore in Spring Boot, I am using @Configuration, @Repository, @Service annotations for different classes in different packages, Structure has been given below. The MySQL DataSource is available in C...
UM1979
0

votes
0

answer
6

Views

Scheduling camel route for google-pubsub component

Apache Camel CronScheduledRoutePolicy not stopping route? I am trying to start and stop my route which reads from google-pubsub component and pushes to a JDBC datasource(oracle). I want to do this only in certain times of day as the Oracle database would be down from say 10pm-12AM every night durin...
ThinkDesign
1

votes
1

answer
1.3k

Views

Get jacoco report from running acceptance test on real application

I'm new to sonar and jacoco and I wasn't able to find an ansewer to following question We are going to use sonar and jacoco to analyze our test coverage. We are going to have three kind of test: unit test, integration test (use spring boot test) and acceptance test that we will run on real applicati...
Evgen
1

votes
1

answer
1.3k

Views

spring boot - web mvc test does not find controller mapping

In this spring-boot project the following WebMvcTest fails because the GET /items mapping from the ItemController is not found @RunWith(SpringRunner.class) @WebMvcTest(ItemController.class) @AutoConfigureMockMvc public class Test_ItemController { @Autowired private MockMvc mvc; @MockBean private It...
tenticon
1

votes
1

answer
727

Views

is there any conflict between spring-boot-starter-parent version 2 and spring-security-jwt and spring-security-oauth2

I am trying to fix an issue I am facing with Spring Boot + Java 8 and Hibernate (my original question regard this issue is org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value did not match expected type java.time.LocalDateTime). Since I read Since 5.2, "the hibernate-java8 mo...
Jim C
0

votes
2

answer
31

Views

Delete a row only into the join table

Question Is it possible to delete a row into a join table created by @ManyToMany annotation? Context With this schema : TAG TAGS_ARTICLES ARTICLE When a tag is removed from public Set tags (a list into ARTICLE class) corresponding rows into TAGS_ARTICLES is removed too, but not the tag into TAG tabl...
N. Lamblin
3

votes
1

answer
27

Views

Is the repo class thread safety for concurrent requests? - Spring boot

I'm using Spring boot with jetty embedded web server for one Web application. I want to be 100% sure that the repo class is thread safety. The repo class @Repository @Scope("prototype") public class RegistrationGroupRepositoryImpl implements RegistrationGroupRepository { private RegistrationGroup rg...
ROZZ
1

votes
1

answer
204

Views

Spring Boot @EnableEurekaClient conditionally

I'm using several profiles for my app, that I can select via the application.yml prop: spring.profiles.active: dev #can be integration, uat, prod My applications all start by: @SpringBootApplication @EnableEurekaClient public class MyApp { } Now, I'd like to enable the eureka client only for selecte...
Phate
1

votes
1

answer
37

Views

Spring Hibernate @Transactional clarifications

I got a lot of confusion about @Transactional annotation. 1) If I use just declarative approach, is it enough to mark my service class/methods as @Transactional, or should I create the configuration beans and properties as shown in this Baeldung article? 2) I need to use even programmatical appr...
4javier
0

votes
2

answer
27

Views

How to do Time Running using java

I have start_time and end_Time so i tried print those interval_times (time format 24) How to do ? int start= Integer.parseInt("10:24:49"); int end= Integer.parseInt("11:24:49"); for(int i = start; i< end; i++){ System.out.println("result i ="+ i); }
Gnanaseelan

View additional questions