0
私は現在、フレームワークとしてspringとgedとしてalfrescoを使用してjava/jeeアプリケーションを開発中です。私はalfrescoリポジトリに接続するためにapache化学を使用しています。 セッションを取得するために使用しているコードです。apache化学セッションspringと
私は別のクラスでこのセッションを使用しようとしているので、このコードをSpring Beanで変更する方法はありますか?シングルトンにする方がよいでしょう。
Map<String, String> parameter = new HashMap<String, String>();
// user credentials
parameter.put(SessionParameter.USER, "admin");
parameter.put(SessionParameter.PASSWORD, "admin");
// connection settings
parameter.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/alfresco/cmisatom");
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
System.out.println(BindingType.ATOMPUB.value());
// set the alfresco object factory
parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
// create session
SessionFactory factory = SessionFactoryImpl.newInstance();
Session session = factory.getRepositories(parameter).get(0).createSession();
通常、私はアプリケーションコンテキストファイルでこのBeanを追加する必要がありますか? –
[Spring doc](http://docs.spring.io/spring-javaconfig/docs/1.0.0.M4/reference/html/ch02s02.html): '@Beanはメソッドレベルの注釈であり、直接XML 要素のアナログです。 –
okありがとうございます:) –