spring-java-config Questions

2

Solved

I have a Spring Security version 3.2.3 application that listens to both HTTP and HTTPS. I want any request to the HTTP port to be redirected to HTTPS. How do I configure that using Java only? Spri...

3

Solved

I would like to have a properties setup which can, on certain environments, override specific properties. For example, our default JDBC properties for dev are: db.driverClassName=com.mysql.jdbc....
Rumery asked 26/11, 2013 at 9:8

2

Is it true that org.springframework.boot.autoconfigure.ImportAutoConfiguration is improved replacement for org.springframework.context.annotation.Import because does the same and additionally respe...
Modigliani asked 27/4, 2017 at 9:19

15

Solved

I'm trying to define access rules at method-level but it's not working what so ever. SecurityConfiguration @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) pub...
Cottonweed asked 7/9, 2015 at 15:57

9

I'm trying to remove the "ROLE_" prefix in Spring Security. The first thing I tried was: http.servletApi().rolePrefix(""); That didn't work, so I tried creating a BeanPostProcessor as suggested ...
Ese asked 30/6, 2016 at 22:15

2

i use from Spring 4.2.6.RELEASE and backend is rest services. and now I can not have a filter for Prevent XSS my filter is: @Component @Order(1) public class XSSFilter implements Filter { @Over...
Fusibility asked 15/8, 2018 at 5:24

8

When defining an EntityManager in a Spring Java Config class, I can add the base packages to scan for Entity classes by calling a method on the corresponding builder: public LocalContainerEntityMa...
Affaire asked 4/12, 2017 at 14:33

3

Solved

My Spring Batch repository (deployed on an Oracle database) lies in a different schema such that I need to prepend the schema name. When using XML configuration, this would be easy to do: <job...
Conchiferous asked 25/5, 2016 at 12:8

4

Solved

I've some experience Spring now and also have some pure java config web-apps in use. However, these are usually based on a quiet simple setup: application config for services / repositories dispa...
Tonedeaf asked 5/3, 2015 at 12:33

2

Solved

I have a Spring Boot web application that works fine. Now I got a 3rd party lib which I must use in the project. The manual of integrating the lib is written with respect to an existing web.xml fil...
Judi asked 5/3, 2018 at 7:26

9

Solved

Using Spring's Java Config, I need to acquire/instantiate a prototype-scoped bean with constructor arguments that are only obtainable at runtime. Consider the following code example (simplified for...
Vizzone asked 3/3, 2014 at 19:43

3

Solved

I'm using Spring Security 3.2 and Spring 4.0.1 I'm working on converting an xml config into a Java config. When I annotate AuthenticationManager with @Autowired in my Filter, I'm getting an except...
Instauration asked 7/2, 2014 at 16:58

1

I have a project with lot of small libraries that define beans with @Configuration classes (Spring Integration and Spring Batch stuff) and I often encounter problems because both libraries have a b...
Cribbing asked 6/12, 2016 at 14:15

3

Solved

When I try to run project, the Tomcat return an exception. Some one can help with this problem? Configuration class: https://github.com/intrade/inventory/blob/master/src/main/java/com/springapp/m...
Jhelum asked 24/1, 2014 at 14:29

14

Solved

I have a spring boot web app with spring security configured. I want to disable authentication for a while (until needed). I add this to the application.properties: security.basic.enable: ...

7

My main job does only read operations and the other one does some writing but on MyISAM engine which ignores transactions, so I wouldn't require necessarily transaction support. How can I configure...
Fandango asked 12/8, 2014 at 5:3

4

Solved

I have two independent spring batch jobs in the same project because I want to use the same infrastructure-related beans. Everything is configured in Java. I would like to know if there's a proper ...
Torticollis asked 4/8, 2014 at 15:21

6

I am trying to secure a web application using Spring Security java configuration. This is how the configuration looks:- @Configuration @EnableWebMvcSecurity public class SecurityConfiguration ext...
Eureetloir asked 3/9, 2014 at 8:0

4

Solved

I have a java configuration where I create bean using some properties, defined in application.properties. For one of them I have a default value which is pretty long, so I extracted this value to a...
Huang asked 17/5, 2018 at 15:22

2

I am attempting to create a Spring Security configuration by extending WebSecurityConfigurerAdapter basically like this: @EnableWebSecurity @Configuration public class StackOverflowSecurityConfig...
Coraliecoraline asked 11/3, 2017 at 0:39

2

Solved

I want to configure in my @Configuration class bean which is already created by other library's autoconfiguration. I just need to change some fields in that class after it's being initialized. But...
Fidele asked 13/9, 2019 at 9:12

4

Solved

Using JavaConfig I have a problem locating the @Repository Spring beans. The repository interface is defined like this: @Repository public interface UserRepository extends JpaRepository<User, ...
Figwort asked 5/5, 2014 at 15:37

2

Solved

Is there some example of how MailSender can be configured via java config? All examples that I've seen uses xml to create needed beans: <bean id="mailSender" class="org.springframework.mail.ja...
Palenque asked 7/6, 2014 at 12:22

1

I have this following component class which I'd like to instantiate depending on a property; @Component("componentA") @PropertySource("classpath:components.properties") @ConditionalOnExpression("'...
Coldblooded asked 25/1, 2016 at 7:37

3

I am currently working on a spring boot project that uses spring batch. I am trying to use JavaConfig instead of xml but it's difficult with all of the docs currently in xml. I followed https://bl...
Ulyssesumayyad asked 8/3, 2017 at 1:36

© 2022 - 2025 — McMap. All rights reserved.