spring-bean Questions

6

I have the java configuration for the Spring Data Elaticsearch(using Transport Client) and ESTemplate. Here some except: @Configuration @EnableElasticsearchRepositories(basePackages = "subpack...

4

Solved

Why is Spring @Value Annotation not working in the constructor? I have this Email class that is reading some email related configuration. In the constructor, if I put a break-point the values are ...

9

Solved

I am trying to setup DynamoDB locally with Spring Boot. Initially I got the setup working and was able to write/save to DynamoDB via a repository. From that point I added more classes to build my a...
Cristionna asked 11/12, 2018 at 11:33

6

Solved

I am just following a tutorial , where in I need to add a spring configuration file but I don't see spring / Spring bean configuration file option in Spring Tool Suite 4 (Version: 4.0.1.RELEASE), ...
Demonstrative asked 7/11, 2018 at 10:12

17

Solved

I am yet to find a high-level definition of Spring beans that I can understand. I see them referenced often in Grails documentation and books, but I think that understanding what they are would be ...
Preamplifier asked 19/6, 2013 at 14:5

8

Solved

I'm using Spring Beans with annotations and I need to choose different implementation at runtime. @Service public class MyService { public void test(){...} } For example for windows's platform ...
Lacrosse asked 18/12, 2015 at 7:56

5

Solved

In my Spring Boot test I'm using 2 mock beans with different qualifiers: @RunWith(SpringRunner.class) @SpringBootTest class HohoTest { @MockBean @Qualifier("haha") IHaha ahaha; @MockBean @Qualif...
Buna asked 6/2, 2019 at 7:21

2

@ContextConfiguration(classes = ConfigureCustomConfigurationModelProviderTest.class) public class ConfigureCustomConfigurationModelProviderTest extends AbstractContextTest { @Bean(name = "smth") ...
Mauer asked 26/11, 2017 at 16:1

2

I'm using spring applications which sometimes uses @PostConstruct for setup in code and tests It seems that annotation will be excluded from Java 11: Note that both @PostConstruct and @PreDestr...
Trounce asked 7/4, 2019 at 13:6

3

Solved

I am new to Spring MVC and have a little idea of the usage of java beans in Java. What is the basic difference between a Java bean and Spring bean?
Immunogenic asked 18/2, 2014 at 22:10

4

I have the following in a Spring bean: @Value("${myValue}") private String value; The value is correctly injected. However, the variable needs to be optional, it is passed in as a command line p...
Studnia asked 28/4, 2014 at 18:0

3

I have a question about auto-wiring order and @PostConstruct logic in Spring. For example following demo code I have a main Spring Boot class: @SpringBootApplication public class Demo1Application ...
Aeropause asked 28/6, 2016 at 6:11

2

I'm learning about Spring MVC with Java configuration (no xml) and I have a simple question. I see 2 approaches of making Spring bean configuration: approach 1: @Configuration @EnableWebMvc @Comp...
Mealworm asked 1/7, 2019 at 9:30

2

Solved

I'm using a Java8/Spring Boot 2 application. I want to inject a request-scoped bean into a singleton bean. The official documentation highlights that either a proxy or ObjectFactory/Provider should...
Had asked 20/5, 2019 at 8:48

2

We were using 4.2.x version of spring and we are using ContextSingletonBeanFactoryLocator to load bean like below BeanFactoryLocator bfLocator = ContextSingletonBeanFactoryLocator.getInstance("cla...
Skindive asked 25/1, 2018 at 6:0

1

Solved

Is this a good practice to use @Bean with static method? public class Foo { } @Configuration public FooFactory { @Bean public static Foo getFoo() { return new Foo(); } }
Phenacaine asked 18/8, 2021 at 10:22

2

Solved

Let's say I have a Camel route that looks like this : from("direct:myRoute") .setHeader("someHeader", simple("some header value")) .beanRef("myBean", "beanMethod"); And I have a bean that I c...
Derose asked 28/5, 2014 at 11:49

9

Solved

I'm using Spring 3.0.5 and am using @Autowire annotation for my class members as much as possible. One of the beans that I need to autowire requires arguments to its constructor. I've looked throug...
Epanaphora asked 18/7, 2011 at 21:17

2

Solved

I've developed a Spring Web-MVC application. I have some offices in my project. Each user belongs to an office. user.getOfficeType() returns an integer representing the user's office type. If the o...
Telemachus asked 16/10, 2015 at 12:16

2

How to alias a bean outside the bean definition using Java config in Spring Boot?
Cheshvan asked 1/3, 2019 at 4:49

5

I think my understanding of spring beans is a bit off. I was working on my project and I was thinking about this situation. Say I have class Foo class Foo(){ public void doSomething(Object a ...
Dismissal asked 25/7, 2015 at 5:20

2

Solved

i am trying to make @SpyBean or @MockBean work in this test as they are working in all my other tests. the only difference here is this test uses an active profile because it mocks some AWS libs ...
Photoconduction asked 21/1, 2020 at 21:5

2

Solved

I have a spring mvc project set up like so: <servlet> <servlet-name>appServlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet...
Griselgriselda asked 2/3, 2012 at 10:9

3

Solved

I made this simple application to connect to the MySQL database and I'm getting this error: org.springframework.jdbc.core.JdbcTemplate In my configuration (com.kubamadry.dao.MySqlStudentDao):...
Ritualism asked 14/7, 2018 at 19:25

1

Solved

Based on this answer I try to configure a request scope bean using java.util.Function interface. My Configuration looks like this: @Configuration public class RequestConfig { @Bean public Func...
Andromache asked 1/8, 2019 at 14:20

© 2022 - 2024 — McMap. All rights reserved.