Questions tagged [javabeans]
A javabean is a custom class which often represents real-world data and encapsulates private properties by public getter and setter methods. For example, User, Product, Order, etc.
3,992
questions
0
votes
0
answers
16
views
Error creating bean with name 'defaultTbMailConfigTemplateService' Thingsboard release-3.6
I have build thingsboard release-3.6 build from sources.
I am facing issue while running boot-jar file in application/target, receiving following error.
ConfigServletWebServerApplicationContext : ...
0
votes
0
answers
23
views
Why i get this exception( UnsatisfiedDependencyException) [duplicate]
Exception
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2023-09-29T20:44:57.421+04:00 ERROR 28232 --- [ main] o....
1
vote
0
answers
49
views
spring boot can't find my repository after adding a new repository
GameRepository.java:
@Repository
public interface GameRepository extends MongoRepository<Game, String> {
}
GameRepositoryReactive.java:
@Repository
public interface GameRepositoryReactive ...
1
vote
1
answer
46
views
Attribute not getting updated while using DynamoDB Enhanced Client
I was updating one of our DynamoDB entities with new attributes.
One of the new attribute is called isEnabled which is of type of String.
It isn’t getting stored in DynamoDB.
This is an example of the ...
0
votes
1
answer
76
views
Can I tell my beans to not inject to a certain library / class?
I'm using an external library which has
@Inject
private Optional<DataSource> dataSource;
which I would very much like to leave empty.
In my service I have 2 DataSources (read and write, and ...
0
votes
1
answer
41
views
Find cause of NotSerializableException: java.util.ArrayList$SubList
I'm using redisson to save sessions of my app. The app uses JSF 2.3.
I'm trying to find the cause of a NotSerializable Exception, but the app only logs redisson stack. Basically it doesn't point to ...
0
votes
0
answers
21
views
How to inject connection details of java testcontainer into Spring bean?
I have a bean that when the Spring container starts and this bean is created will connect to a mqtt broker in @PostConstruct.
The problem is that the testcontainer starts after the bean is created. So ...
0
votes
1
answer
23
views
Persistence does not ocur in a stateless bean, using JPA when duplicate key exception is thrown
In a stateless bean, i´ve persisted a customer, but when I try to persist an entity product, this trows a duplicate key exception.
So the customer is not persisted in db. Why is that?
@Stateless
...
0
votes
0
answers
19
views
Why can not get value from application in spring boot
`I have a problem
I trying get value from applycation.properties to my class.
I have configured in many other classes this way and it is still valid until...
This is my class that i want get value ...
0
votes
0
answers
21
views
Consider defining a bean of type 'com.example.backend.s1.S1Repo' in your configuration
I am getting error like given below i have used annocations like component scan and also I have specfied the annocations properly this is a instance of another big project
I have done the ...
0
votes
0
answers
20
views
Convert string from property to list to pass it to SQL in XML Bean
Hi I have an XML bean code where I am getting a property which is a string with some country names separated by commas I want to pass it to the SQL I have written in the code I write a single country ...
0
votes
0
answers
44
views
OpenWebBeans throws NoSuchElementException java ee
I created the configuration of OpenWebBeans as indicated in the video tutorial, but for some reason I get a NoSuchElementException exception. Why can't I find Bean's name? How to fix it?
project ...
0
votes
1
answer
43
views
Which scope is generally used for spring beans?
For a Spring-based Java web application, how can I structure the controller, service, DAO class efficiently using Spring beans?
Currently my structure is like this
TestController.class (Prototype ...
0
votes
1
answer
34
views
How to resolve No bean named 'xxx' available?
The bean dataSource is not created below. Due to this reason there is a problem in creating entityManagerFactory bean. My question is why the bean dataSource is not created? Is the reason behind the ...
0
votes
0
answers
70
views
Spring Security upgrade, SecurityContextPersistanceFilter to SecurityContextHolderFilter
Im upgrading my project code to Spring 5, and Java 8 to 11. At first for the authentication.xml we used HttpSessionContextIntegrationFilter. Now we are trying to replace it with ...
2
votes
2
answers
31
views
How to get datetime in UTC format using Primefaces clock component?
I am trying to use PrimeFaces clock component and get the current datetime in UTC format. However, I have tried several time zones and always date the same value.
<p:clock pattern="HH:mm" ...
0
votes
2
answers
28
views
Error in import statement for accessing beanfactory
I am trying to implement a basic spring example my import statements are
import org.springframework.context.ApplicationContext;
import org.springframework.context.support....
0
votes
1
answer
23
views
Spring Boot Jpastreamer - com.speedment.jpastreamer.application.JPAStreamer can not be found
I have a problem to run my Spring Boot with the usage of Jpastreamer.
I cannot solve the bean issue related with Jpastreamer.
Here is the PersonService shown below
@Service
@RequiredArgsConstructor
...
0
votes
0
answers
23
views
Parameter 0 of constructor in one.business.Validation required a bean of type two.client.IRestClient' that could not be found
If I don't use @Component for the class the application is running, but I need to use @Component for the class.
I need to use a @Service class interface i.e IRestClient
Service class
@Service
public ...
0
votes
1
answer
80
views
JMSTemplate Bean not found - Autowire doesn't work
It worked fine yesterday and suddenly it doesn't work anymore. I didn't change anything tho. I am new to JMS and followed this tutorial: Tutorial
I just want to send and receive Messages with the ...
0
votes
0
answers
15
views
How to get the jwt authentication using Spring?
i'm new to Spring Boot and i'm trying to do the JWT Authentication so i followed several tutorials like this one https://www.learncodewithdurgesh.com/blogs/jwt-authentication-with-spring-boot-31 but i ...
0
votes
1
answer
46
views
Converting xml beans to java config issue
I have a bean in xml:
<bean id="fooBean" class="org.model.Foo" scope="prototype">
<property name="propOne" ref="fooBarOne"/>
<...
0
votes
1
answer
36
views
is there any way to inject all implementers (JSF Beans) of an interface in a Service managed by Spring?
I have this interface
public interface DataHandler {
void getData();
String getControllerPrefix();
}
And it is being implemented in different controllers like the following
@ManagedBean
@...
0
votes
2
answers
70
views
what this error means 'org.json.JSONObject'?
QuestionController Class:
package app.controller;
import java.util.List;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web....
1
vote
1
answer
39
views
I encountered an error while using MQTT in my project: Unable to register MBean
I want to use MQTT in my project, but when I followed the instructions on https://docs.spring.io/spring-integration/reference/html/mqtt.html#mqtt-shared-client, I encountered this error. Can someone ...
0
votes
0
answers
51
views
@Scope("prototype") is not working in spring boot upgrade from version 2.1.7 RELEASE to 2.7.11 RELEASE
I have a bean annotated with @Scope("prototype"). It worked well with Spring boot 2.1.7 RELEASE. Spring created this bean only when requested from application context, but after upgrading ...
0
votes
1
answer
58
views
How can I write test cases for @Bean method?
@Bean
public MongoTemplate method1() throws Exception {
return new MongoTemplate(mongoDbConnection(), databaseName);
}` @Bean
public MongoClient method2() throws Exception {
uri = uri + &...
0
votes
1
answer
45
views
How to find bean declaration from interface
Consider the following interface in spring boot
public interface SecurityFilterChain {
boolean matches(HttpServletRequest request);
List<Filter> getFilters();
}
This ...
0
votes
2
answers
67
views
Loading a document item values into a map using DataObject in a bean in XPages
I am trying to create a bean that is using the DataObject to collect value from a document.
code is inspired by this post
package com.consili;
import lotus.domino.*;
import java.util.*;
import com....
0
votes
0
answers
22
views
Order of bean creation and call to auto-configuration class in Spring Boot
I am creating a spring boot library with auto-configuration. The library reads the message from given kafka topic and processes it.
The library has a configuration class:
public class LibConfiguration{...
0
votes
0
answers
152
views
@ConditionalOnProperty doesn't work as its havingValue property
// application.yml
board:
qtalk:
expiration: false
// ScheduleService.kt
@Service
class ScheduleService {
@Bean("executeAdopt")
@Scheduled(fixedDelay = 2000)
@...
0
votes
0
answers
44
views
Deserialisation Failure on adding/removing field in Java Bean (Spark)
We have Encoded Java bean in Spark application using Encoders.bean(Class<?> beanClass). Later on when we remove/add field from Java bean and try to deserialise, it fails with below exception.
...
0
votes
0
answers
112
views
UnsatisfiedDependencyException when try to start JAR file
When I tried to run JAR file with command " java -jar ./artifacts/aqa-shop.jar -Dspring.datasource.url=jdbc:mysql://localhost:3306/app " I got an Exception " ...
0
votes
0
answers
21
views
Interceptor not working in JAX-rs project
I'm using websphere liberty. Gradle project. Jax-rs spec. Trying to get a simple interceptor to work. For example:
@Interceptor
@Logged
public class LoggedInterceptor {
@AroundInvoke
public ...
0
votes
1
answer
76
views
ConditionalOnProperty - mock
I'm trying to prepare a class which will mock one of it's fields if a testing mode is enabled.
Here is the code:
@Configuration
public class StripeConfig {
@Bean
@ConditionalOnProperty(prefix =...
0
votes
3
answers
83
views
Parameter 0 of constructor in ComponentClass required a bean of type 'JpaRepository' that could not be found
@Repository
public interface SomeJpaRepository extends JpaRepository<SomeEntity, String>
{
@Modifying
//....
}
my component:
@Component
@Slf4j
public class SomeComponentClass
{
private ...
0
votes
0
answers
20
views
Problem with creating my controller bean, when importing a data from the database
I have this java class which is importing data from the database:
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import java.time....
0
votes
1
answer
220
views
Problem with registering controller using @Bean annotation in class annotated with @Configuration
I have recently updated my project to spring boot v 3.0.6 (from 2.2.5) and Java version 17 (from 11).
My approach is to register the controller not by using class-level annotations (like @Controller ...
0
votes
1
answer
272
views
ApplicationScoped beans in Java EE with CDI
When the ApplicationScoped beans will be created ?
At injection points or when application will be deployed ?
0
votes
1
answer
46
views
creating bean with name webSec
so i'm working on authentication with spring and using jwt but i got this error while i created the class of // i made some researches but nothing really worked for me
this is the class:
@...
0
votes
0
answers
53
views
Why I am getting NULL pointer Exception when injecting the bean as follows?
I am using Apache Shiro for Authentication/Authorization. I am good with the Authentication part using signed JWT. But, as for the auth part I am facing a NULL pointer exception on when accessing the ...
0
votes
0
answers
46
views
Spring Service autowiring producing NPE
Main class:
@SpringBootApplication
public class MicroserviceClientApplication implements ApplicationRunner {
private static final Logger LOGGER = LoggerFactory.getLogger(...
0
votes
1
answer
68
views
xml file was showing error in" <context:annotation-config/> "tag
while implementing bean lifecycle using annotations, faced a issue where my xml file was showing error in" context:annotation-config/ "tag .
i added:
`<dependency>
<groupId>...
0
votes
1
answer
78
views
Spring bean change configuration on runtime
I need to session manager to connection SAP server. I use spring bean to create session manager. I get SAP server configuration from hibersap.xml. I was connecting to a single server before. But now I ...
1
vote
1
answer
118
views
Using Stateless Beans in Quarkus CDI
I have a library containing services annotated with @Stateless which i am not able to modify. For example something like this:
@Stateless
@Local(MyServiceLocal.class)
@Remote(MyServiceRemote.class)
...
0
votes
1
answer
81
views
Best practice for storing and reading data from Java Beans in XPages
I have the following Java bean code that stores a list of tabs in an ArrayList<String> in a sessionScope, so I do not have to look it up for every request.
public class BeanMethods {
...
0
votes
0
answers
53
views
java springboot jdbc java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.dialect.InterbaseDialect
I am trying to have a simple java springboot application that talks to a DB through JDBC driver ( interbase ).
This is the code that compiles AND successfully connects and queries the DB:
package com....
0
votes
2
answers
54
views
How to specify bean to be initialize base on conditional
I'm having a factory that have to be create base on config.property value
@Service
@RequiredArgsConstructor
@ConditionalOnProperty("'${config.property}==a' or '${config.property}==b'")
...
0
votes
1
answer
694
views
Spring boot Application running fine on intellij idea but not working on terminal
Spring boot Application is running fine on intellij idea but on running the same jar file on terminal it shows the following error:
ConfigServletWebServerApplicationContext : Exception encountered ...