spring-4

Context initialization failed after updating Spring Version

二次信任 提交于 2019-12-14 02:50:32
问题 I've recently updated my Spring version from 3.2.4.RELEASE to 4.0.7.RELEASE and since then I'm getting this error while loading context. Please let me know if I'll have to make any changes to context xml after updating spring version. Here is the avengers-flow-context.xml : <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns:int="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema

Deployed Simple HelloWorld with Spring MVC app (without web.xml) gives 404 error

主宰稳场 提交于 2019-12-12 12:36:00
问题 I am newbie to Spring MVC with annotations, I have worked with Spring MVC XML Configuration earlier. I get 404 error when I try to hit the url http://localhost:8080/HelloWorldApp. I have written three classes: 1. AppIntializer 2. AppConfig 3. AppController Following piece of code: package com.demo; public class AppIntializer implements WebApplicationInitializer { private static final String CONFIG_LOCATION = "com.demo.config"; @Override public void onStartup(ServletContext servletContext)

Spring 4 - reject “null” @RequestBody for all endpoints

放肆的年华 提交于 2019-12-12 11:10:15
问题 Jackson deserializes the "null" string as a null request body which is expected (although it would be nice to be able to switch this behaviour off). The code below triggers validation in case of "{}" payload but not in case of "null" payload. This forces me to do another check for null payload which doesn't seem normal to me since the PayloadValidator could include the null check itself. @InitBinder protected void initBinder(WebDataBinder binder) { binder.setValidator(new PayloadValidator());

Spring - Batch update using simplejdbccall while using Stored Procedure

会有一股神秘感。 提交于 2019-12-12 10:26:15
问题 I am using spring jdbc template, to create record using stored procedure public Long create(City $obj) { SimpleJdbcCall jdbcCall = new SimpleJdbcCall(getJdbcTemplate().getDataSource()).withProcedureName(SP_ADD_UPDATE); jdbcCall.declareParameters(new SqlOutParameter(ConstantUtil.RETUR_VAL, OracleTypes.BIGINT)); Map<String, Object> jdbcCallResult = jdbcCall.execute(new MapSqlParameterSource(populateParams($obj))); return (Long) jdbcCallResult.get(ConstantUtil.RETUR_VAL); } params private static

what is the difference between using or not Spring Beans?

拟墨画扇 提交于 2019-12-12 09:43:31
问题 Probably i'll get a lot of downvotes, but it's so confusing for me all this fact of whether use beans or not. Lets suppose this example interface ICurrency { String getSymbol(); } public class CurrencyProcessor { private ICurrency currency ; public CurrencyProcessor(ICurrency currency) { this.currency = currency; } public void doOperation(){ String symbol = currency.getSymbol(); System.out.println("Doing process with " + symbol + " currency"); // Some process... } } So, to inject the

how to set many targets to ProxyFactoryBean?

£可爱£侵袭症+ 提交于 2019-12-12 04:48:36
问题 I am working with Spring 4 AOP and right now, i have my ProxyFactoryBean configured like this: @Bean @Primary public ProxyFactoryBean proxyFactoryBean() { ProxyFactoryBean proxyFactoryBean = new ProxyFactoryBean(); proxyFactoryBean.setTarget(new ClientService()); proxyFactoryBean.addAdvice(new LoggingAdvice()); proxyFactoryBean.addAdvice(new DebugInterceptor()); return proxyFactoryBean; } This works, but the target is just the ClientService object. Is it possible to set many targets and not

Tiles 3 how to reference another definition in put-attribute

橙三吉。 提交于 2019-12-12 04:33:27
问题 I'd like to be able to define a base definition, where I can inherit a list of styles and scripts. then define a page definition that inherits base definition, and adds page specific styles and scripts. Is this possible -or am I not thinking about this in the right way? I would have thought this to be a fairly basic idea. base definitions <tiles-definitions> <!-- base styles --> <definition name="base.styles" > <put-list-attribute name="styles" cascade="true" > <add-attribute value="/view

Upgrading spring from 3.2 to 4 - Issue with generics (extends)

霸气de小男生 提交于 2019-12-12 02:37:20
问题 I have the below code that worked with spring 3.2 and fails with a "NoSuchBeanDefinitionException" on spring 4.0.0.RELEASE public interface Cacheable { } public class TimeUnit implements Cacheable { } @Component public class UserDao&ltT extends Cacheable&gt { public void performDBOperation() { System.out.println("Executing db operation"); } } @Component public class UserService { @Autowired private UserDao&ltTimeUnit&gt timeUnitUserDao; public void someService() { timeUnitUserDao

Getting a Failed to start bean 'subProtocolWebSocketHandler' exception while trying to implement websockets

て烟熏妆下的殇ゞ 提交于 2019-12-11 13:27:21
问题 I am going through the websockets with Spring 4 tutorial here. I have it working where the server responds when client calls. However, my use case is having the server push the messages without client having to call. So I looked up online on ways to do that and came across a few posts that said that I needed to use something called SimpMessagingTemplate . So I changed the code to use the SimpMessagingTemplate . Now I get this exception in the server console: 04-Jun-2016 22:49:24.093 SEVERE

Spring autowiring parameterized generic types

﹥>﹥吖頭↗ 提交于 2019-12-11 09:06:13
问题 Spring 4 included major enhancements to generic type resolution, but I'm having trouble with autowiring a generic type when the type argument is parameterized on the containing bean class. I am needing to track the status of jobs submitted to an outside service, and I want to create an entry for each job when it starts and clear or update it when I receive postbacks. I generally try to keep my persistence strategy separated from the service interface, so I have an interface JobStatus and a