mirror of https://github.com/apache/cloudstack.git
add more files
This commit is contained in:
parent
d70154609a
commit
f36b2f9970
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
|
||||
import org.apache.cloudstack.storage.volume.Volume;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao;
|
||||
|
|
@ -12,12 +13,14 @@ import org.apache.cloudstack.storage.volume.disktype.VolumeDiskType;
|
|||
|
||||
public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
|
||||
protected PrimaryDataStoreDriver driver;
|
||||
protected List<VolumeDiskType> supportedDiskTypes;
|
||||
protected DataStoreVO pdsv;
|
||||
protected PrimaryDataStoreInfo pdsInfo;
|
||||
@Inject
|
||||
VolumeDao volumeDao;
|
||||
public DefaultPrimaryDataStoreImpl(PrimaryDataStoreDriver driver, List<VolumeDiskType> types) {
|
||||
public VolumeDao volumeDao;
|
||||
public DefaultPrimaryDataStoreImpl(PrimaryDataStoreDriver driver, DataStoreVO pdsv, PrimaryDataStoreInfo pdsInfo) {
|
||||
this.driver = driver;
|
||||
this.supportedDiskTypes = types;
|
||||
this.pdsv = pdsv;
|
||||
this.pdsInfo = pdsInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -46,7 +49,7 @@ public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
|
|||
return null;
|
||||
}
|
||||
|
||||
if (!this.getSupportedDiskTypes().contains(diskType)) {
|
||||
if (!pdsInfo.isVolumeDiskTypeSupported(diskType)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -55,9 +58,4 @@ public class DefaultPrimaryDataStoreImpl implements PrimaryDataStore {
|
|||
vol.update();
|
||||
return vol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeDiskType> getSupportedDiskTypes() {
|
||||
return this.supportedDiskTypes;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,5 +28,4 @@ public interface PrimaryDataStore {
|
|||
List<Volume> getVolumes();
|
||||
boolean deleteVolume(long id);
|
||||
Volume createVolume(long id, VolumeDiskType diskType);
|
||||
List<VolumeDiskType> getSupportedDiskTypes();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore;
|
||||
|
||||
import org.apache.cloudstack.storage.volume.disktype.VolumeDiskType;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
||||
public interface PrimaryDataStoreInfo {
|
||||
public boolean isHypervisorSupported(HypervisorType hypervisor);
|
||||
public boolean isLocalStorageSupported();
|
||||
public boolean isVolumeDiskTypeSupported(VolumeDiskType diskType);
|
||||
public long getCapacity();
|
||||
public long getAvailableCapacity();
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
|
||||
import org.apache.cloudstack.storage.volume.disktype.VolumeDiskType;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
|
||||
public class PrimaryDataStoreInfoImpl implements PrimaryDataStoreInfo {
|
||||
protected List<HypervisorType> supportedHypervs;
|
||||
protected List<VolumeDiskType> supportedDiskTypes;
|
||||
protected long caapcity;
|
||||
protected long avail;
|
||||
protected boolean localStorage;
|
||||
|
||||
public PrimaryDataStoreInfoImpl(List<HypervisorType> hypers, List<VolumeDiskType> diskTypes,
|
||||
long capacity, long avail, boolean localStorage) {
|
||||
this.avail = avail;
|
||||
this.caapcity = capacity;
|
||||
this.localStorage = localStorage;
|
||||
this.supportedDiskTypes = diskTypes;
|
||||
this.supportedHypervs = hypers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHypervisorSupported(HypervisorType hypervisor) {
|
||||
return this.supportedHypervs.contains(hypervisor) ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocalStorageSupported() {
|
||||
return this.localStorage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVolumeDiskTypeSupported(VolumeDiskType diskType) {
|
||||
return this.supportedDiskTypes.contains(diskType) ? true : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCapacity() {
|
||||
return this.caapcity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getAvailableCapacity() {
|
||||
return this.avail;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ import java.util.Map;
|
|||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.DataStoreStatus;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.storage.StoragePoolDetailVO;
|
||||
import com.cloud.storage.dao.StoragePoolDetailsDao;
|
||||
|
|
@ -44,6 +45,7 @@ import com.cloud.utils.db.SearchCriteria.Func;
|
|||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Component
|
||||
public class PrimaryDataStoreDaoImpl extends GenericDaoBase<DataStoreVO, Long> implements PrimaryDataStoreDao {
|
||||
protected final SearchBuilder<DataStoreVO> AllFieldSearch;
|
||||
protected final SearchBuilder<DataStoreVO> DcPodSearch;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.db;
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface PrimaryDataStoreProviderDao extends GenericDao<PrimaryDataStoreProviderVO, Long> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.db;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
|
||||
@Component
|
||||
class PrimaryDataStoreProviderDaoImpl extends GenericDaoBase<PrimaryDataStoreProviderVO, Long> implements PrimaryDataStoreProviderDao {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.db;
|
||||
|
||||
public class PrimaryDataStoreProviderVO {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.lifecycle;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class DefaultPrimaryDataStoreLifeCycleImpl implements PrimaryDataStoreLifeCycle {
|
||||
|
||||
@Override
|
||||
public boolean registerDataStore(Map<String, String> dsInfos) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean attach(long scope) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dettach(long dataStoreId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unmanaged(long dataStoreId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean maintain(long dataStoreId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancelMaintain(long dataStoreId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteDataStore(long dataStoreId) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.lifecycle;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface PrimaryDataStoreLifeCycle {
|
||||
public boolean registerDataStore(Map<String, String> dsInfos);
|
||||
public boolean attach(long scope);
|
||||
public boolean dettach(long dataStoreId);
|
||||
public boolean unmanaged(long dataStoreId);
|
||||
public boolean maintain(long dataStoreId);
|
||||
public boolean cancelMaintain(long dataStoreId);
|
||||
public boolean deleteDataStore(long dataStoreId);
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.manager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreProviderDao;
|
||||
import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class DefaultPrimaryDataStoreManagerImpl implements PrimaryDataStoreManager {
|
||||
@Inject
|
||||
PrimaryDataStoreProviderDao dataStoreProviderDao;
|
||||
@Override
|
||||
public PrimaryDataStore getPrimaryDataStore(long dataStoreId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.cloudstack.storage.datastore.manager;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
|
||||
import org.apache.cloudstack.storage.datastore.lifecycle.PrimaryDataStoreLifeCycle;
|
||||
|
||||
public interface PrimaryDataStoreManager {
|
||||
public PrimaryDataStore getPrimaryDataStore(long dataStoreId);
|
||||
public PrimaryDataStoreLifeCycle getPrimaryDataStoreLifeCycle(long dataStoreId);
|
||||
}
|
||||
|
|
@ -2,15 +2,41 @@ package org.apache.cloudstack.storage.datastore.provider;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStoreImpl;
|
||||
import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
|
||||
import org.apache.cloudstack.storage.datastore.PrimaryDataStoreInfo;
|
||||
import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.driver.DefaultPrimaryDataStoreDriverImpl;
|
||||
import org.apache.cloudstack.storage.datastore.driver.PrimaryDataStoreDriver;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.utils.component.ComponentInject;
|
||||
|
||||
@Component
|
||||
public class DefaultPrimaryDatastoreProviderImpl implements
|
||||
PrimaryDataStoreProvider {
|
||||
protected PrimaryDataStoreDriver driver;
|
||||
@Inject
|
||||
public PrimaryDataStoreDriver driver;
|
||||
public PrimaryDataStoreDao dataStoreDao;
|
||||
|
||||
public DefaultPrimaryDatastoreProviderImpl() {
|
||||
this.driver = new DefaultPrimaryDataStoreDriverImpl();
|
||||
}
|
||||
@Override
|
||||
public PrimaryDataStore getDataStore(String dataStoreId) {
|
||||
public PrimaryDataStore getDataStore(long dataStoreId) {
|
||||
DataStoreVO dsv = dataStoreDao.findById(dataStoreId);
|
||||
if (dsv == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PrimaryDataStore pds = new DefaultPrimaryDataStoreImpl(driver, dsv, null);
|
||||
pds = ComponentInject.inject(pds);
|
||||
return pds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package org.apache.cloudstack.storage.datastore.provider;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
|
||||
import org.apache.cloudstack.storage.datastore.PrimaryDataStoreInfo;
|
||||
|
||||
public interface PrimaryDataStoreProvider {
|
||||
public PrimaryDataStore getDataStore(String dataStoreId);
|
||||
public PrimaryDataStore getDataStore(long dataStoreId);
|
||||
public PrimaryDataStoreInfo getDataStoreInfo(long dataStoreId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import java.util.LinkedList;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStoreImpl;
|
||||
import org.apache.cloudstack.storage.datastore.provider.DefaultPrimaryDatastoreProviderImpl;
|
||||
import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProvider;
|
||||
import org.apache.cloudstack.storage.volume.VolumeMotionService;
|
||||
|
|
@ -102,6 +103,10 @@ public class volumeServiceTest {
|
|||
@Test
|
||||
public void testStaticBean() {
|
||||
DefaultPrimaryDatastoreProviderImpl provider = ComponentInject.inject(DefaultPrimaryDatastoreProviderImpl.class);
|
||||
assertNotNull(provider.driver);
|
||||
assertNotNull(provider.dataStoreDao);
|
||||
|
||||
DefaultPrimaryDataStoreImpl dpdsi = new DefaultPrimaryDataStoreImpl(null, null, null);
|
||||
ComponentInject.inject(dpdsi);
|
||||
assertNotNull(dpdsi.volumeDao);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
|
|||
public class ComponentInject {
|
||||
|
||||
private static AutowireCapableBeanFactory beanFactory;
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private void setbeanFactory(AutowireCapableBeanFactory bf) {
|
||||
ComponentInject.beanFactory = bf;
|
||||
|
|
@ -17,4 +18,10 @@ public class ComponentInject {
|
|||
public static <T> T inject(Class<T> clazz) {
|
||||
return beanFactory.createBean(clazz);
|
||||
}
|
||||
|
||||
public static <T> T inject(T obj) {
|
||||
beanFactory.autowireBean(obj);
|
||||
beanFactory.initializeBean(obj, null);
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue