Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am makensi on github.
  • I am eitypic (https://keybase.io/eitypic) on keybase.
  • I have a public key ASBLXYzy0KdTCSJSq07s8x7jVBASc8LzZD_xmlNPW0hGAAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am makensi on github.
  • I am makensinc (https://keybase.io/makensinc) on keybase.
  • I have a public key ASDaSSbcbzaQ_TB2LDBDx52YuqBu1F9c9hkdi7HTGz9vzAo

To claim this, I am signing this object:

<form id="form" enctype="multipart/form-data" method="post">
<input id="file" type="file" name="file"/>
<input type="submit" />
</form>
@RequestMapping(method = RequestMethod.POST, value = "/images", consumes = { "multipart/form-data", "multipart/mixed" })
public void insert(@RequestPart("file") MultipartFile file) throws Exception{
// ...
}
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="1000000"/> <!-- 10 MG -->
</bean>
<bean id="dataSource1" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/master/dataSource1" />
</bean>
<bean id="dataSource2" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/master/dataSource2" />
</bean>
<bean id="dataSource3" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/master/dataSource3" />
</bean>
public class RoutingDataSourceImpl extends AbstractRoutingDataSource {
@Autowired
private User user;
public void setUser(User user) {
this.user = user;
}
@Override
class User implements Serializable {
private Long id;
private String name;
private String environment;
public User(){
}
<bean id="user" class="com.nc.User" scope="session">
<aop:scoped-proxy />
</bean>
<bean id="dataSource1" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/master/dataSource1" />
</bean>
<bean id="routingDataSource" class="com.nc.datasource.RoutingDataSourceImpl">
<property name="targetDataSources">
<map>
<entry key="ds1" value-ref="dataSource1" />
</map>
</property>