spring-java-config

Using Spring Dynamic Languages Support from Java Configuration

╄→гoц情女王★ 提交于 2019-12-30 17:45:08
问题 I'd like to use Dynamic Languages Support of Spring Framework. In XML I'd just use the lang namespace, but I'd like to use Java configuration (i.e. @Configuration classes) only . I can imagine that I can do it by initializing all the hell from org.springframework.scripting.config package, inc. all the BeanPostProcessor s, Handler s, Parser s and FactoryBean s they create, but I really don't want to go there. Is there some other way? If there's none, what will be the minimal configuration

Spring-Boot + Spring-MVC + Thymeleaf + Apache Tiles

烈酒焚心 提交于 2019-12-28 18:45:28
问题 I have an already existing client module with apache tiles and thymeleaf, what works well. I wanted to convert it to spring-boot and wanted to do it step by step, but I am really stucking with it. I dont want to change to much once, I would love it when someone can tell me, what step I should do first and bring it to run. I already tried to write the servlets in javaConfig, but I am stucking then too. Maybe someone can help me please. If more information is needed, please dont hesitate to ask

Spring security oauth2 and form login configuration

巧了我就是萌 提交于 2019-12-28 10:06:08
问题 My project consists exposes two different parts, a JSF admin panel and a RESTfull service. I am trying to setup spring security to use different authentication methods depending on the URL the user navigates. The requirements are Users navigating to the JSF page get a login screen where they authentication using form authentication. Users navigating to the REST service use OAuth2 implicit authentication with basic authentication for the token granting. The seperate configurations work by

Disable Basic Authentication while using Spring Security Java configuration

社会主义新天地 提交于 2019-12-28 04:07:08
问题 I am trying to secure a web application using Spring Security java configuration. This is how the configuration looks:- @Configuration @EnableWebMvcSecurity public class SecurityConfiguration extends WebSecurityConfigurerAdapter { private String googleClientSecret; @Autowired private CustomUserService customUserService; /* * (non-Javadoc) * * @see org.springframework.security.config.annotation.web.configuration. * WebSecurityConfigurerAdapter * #configure(org.springframework.security.config *

Spring Batch dynamic Flow/Job construction

隐身守侯 提交于 2019-12-25 04:21:52
问题 I'm currently using Spring Batch to run a job that processes a file, does some stuff on each line and writes the output to another file. This was developed in a 'core' product but now (as always) we have some client-specific requirements that mandate the inclusion of some extra steps in the job. I've been able to do a proof-of-concept where use the common Spring features to be able to 'replace' the job with another one with the extra steps either by using distinct names for the job (if we

Spring Boot take over web.xml configuration

自闭症网瘾萝莉.ら 提交于 2019-12-25 00:49:18
问题 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 file. My project completely relies on a Java based config. According to the Spring documentation I can reach my goal of taking over the web.xml content into my application with the help of a WebApplicationInitializer. That's what I did (at least I think I did it correctly). Before going into more

Spring Batch Late Binding Within SQL Using Java Config

时光怂恿深爱的人放手 提交于 2019-12-25 00:12:33
问题 We are converting xml-based spring batch configuration to java config. In xml form of JdbcCursorItemReader we were using late binding: SELECT * FROM MY_TABLE_#{jobParameters[param1]} How can this be implemented using Java config syntax? 回答1: You can achieve this as follows: @Bean @StepScope public JdbcCursorItemReader jdbcCursorItemReader(@Value("#{jobParameters['param1']}") String param1) { return new JdbcCursorItemReaderBuilder<>() .sql("SELECT * FROM MY_TABLE_" + param1) // set other

In Spring JavaConfig, should the bean return type be the interface or implementation?

蹲街弑〆低调 提交于 2019-12-24 15:09:55
问题 When I configure a class that implements DataSource (for example HikariCP) via XML, it looks something like this: <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close"/> According to the Spring Reference manual, the equivalent of this in JavaConfig is: @Bean (destroyMethod = "close") public DataSource dataSource () { return new HikariDataSource(); } Why are we returning the interface type in JavaConfig, especially in this case, where DataSource doesn't have a

What is the java config equivalent to tcp-outbound-gateway?

陌路散爱 提交于 2019-12-24 05:26:09
问题 I have the following spring-integration XML config <ip:tcp-outbound-gateway id="outboundClient" request-channel="requestChannel" reply-channel="string2ObjectChannel" connection-factory="clientConnectionFactory" request-timeout="10000" reply-timeout="10000"/> How can I write the Java config equivalent of the above? I thought the equivalent would be @Bean public TcpOutboundGateway outboundClient() { TcpOutboundGateway tcpOutboundGateway = new TcpOutboundGateway(); tcpOutboundGateway

Spring Security JavaConfig: Configure required Channels (secure, insecure, any)

假如想象 提交于 2019-12-24 05:19:13
问题 I'm trying to serve all static resources (css, javascript and images) through any channel but can't get it to work in combination with .anyRequest().requiresInsecure() : @Configuration @EnableWebMvcSecurity @PropertySource("classpath:security.properties") public class SecurityConfig extends WebSecurityConfigurerAdapter { @Value("${security.auth_urls}") private String[] authUrls; @Value("${security.secured_urls}") private String[] securedUrls; @Override protected void configure(HttpSecurity